For the file C:\filename.txt
,
File.Exists(@"c:\filename.txt/");
returns true
. But when we then try to open with that filename, it fails.
The filename is bad because of the trailing /. But how can we test to know if a file is valid as this tells me it is not only ok, but that the file exists.
Update: In a standard command line test app the results are as expected (false). But in my custom uri handler the File.Exists() returns true. It's really bizarre.
Usually, when querying a system folder, file visualization is the culprit in this kind of issue. IE the file exists at the virtual store location but not in the actual queried path. As a result, attempting to open it will fail. So, before you state that the file doesn't exist. . . you should make sure it really doesn't exist.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With