Get real path of a log file stored in VirtualStore

Viewed 2726

My application stores log files in a location which, depending on admin settings, can get redirected to a folder in the VirtualStore. They sometimes end up in, for example:

The log file is in:

C:\Users\-my username-\AppData\Local\VirtualStore\Program Files (x86)\ *my-application* \logs

C# thinks it is here:

C:\Program Files (x86)\ my-application \logs

This is only a problem in one part of the code - a button which tries to open the log file in notepad. It runs Process.Start( path-where-application-thinks-log-files-are );

If I test this using File.Exists( path-where-application-thinks-log-files-are ); I get true - because c# knows to look in the VirtualStore location. But when I try to launch the file, it fails.

So my question is, is there a way to convert a path into the correct location, from the point of view of the Process.Start() command?

3 Answers
Related