[ACCEPTED]-File Exists in WPF-c#
Accepted answer
Try this to get the file in the executables 1 directory.
string directory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
string filePath = Path.Combine(directory, "SomeFile.exe");
if (!File.Exists(filePath))
{
// 1337 code here plx.
}
If your testing it from VS then the current 2 directory is the Project dir not the release/debug 1 folder (where your exe is)
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.