'Opening File Explorer with a path to a shared folder doesn't work
I have a WPF app in which a file is selected, operated on, and then saved to the same directory under a new name. Pretty standard stuff and all of that operates as expected.
There are buttons on the UI which gives the user the option to either open the file with the default application for its filetype specified in the OS or to open the directory of the file in File Explorer. However, when the specified file path is in a shared folder, both of the buttons open File Explorer to its default location which is the Documents folder. The modified file is still able to be saved to the shared folder though.
This is how File Explorer is opened in the code:
ProcessStartInfo startInfo = new ProcessStartInfo
{
Arguments = vm.OutputPath,
FileName = "explorer.exe"
};
Process.Start(startInfo);
I suspect this issue has something to do with the fact that the shared folder is only defined at the user level and is unable to be found when opening File Explorer with Process.Start(...)
Is there anything I can do in the code to correct this?
Solution 1:[1]
Issue has been solved thanks to Panagiotis Kanavos' comment on my question. I was dumb and didn't consider the fact that the path could contain spaces and thus needs to be surrounded in double quotes for explorer.exe to accept it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | JackRentz-Essentium |
