I am trying to find out if a file exists in a shared drive from a Windows machine in the local network. The drive can be easily mounted and accessed with my machine and it does not require credentials. I am using Visual Studio for Mac.
I am using the following code in C# and exists is false:
FileInfo fileInfo = new FileInfo(@"\\servername\folder\file.pdf");
bool exists = fileInfo.Exists;
I tried the code in windows and exist is true. I don't know different things between Mac and Windows.
I think that the issue is that FileInfo does not actually access the shared drive and path in the argument, checking the fileinfo with FullPath properties as below.
"/Users/me/Projects/CurrentProjectFolder/\\\\servername\\folder\\file.pdf"
It is under User path. Please tell me why and how to solve.