I have an *.exe file in \\ProgramFiles(x86)\\MyAppFolder.
In x86 application I check if the file exists (64 bit system). simple:
bool fileExists = File.E
The difference between File.Exists()
and new FileInfo().Exists
on it's behavior when full path (directory name + file name) is long:
var f = @"C:\Program Files (x86)\MyAppFolder\many_subfolders\manager.exe";
//f.length > 260 characters
bool fileExists = File.Exists(f); //return false, even if the file exists
// Throw exception: "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters."
bool fileInfoExists = new FileInfo(f).Exists;