Update Program.cs

Update so program can handle path with spaces in it.
Update location of debugging output data to a spot where a user most likely has access to write.
This commit is contained in:
kougyoku 2022-05-09 11:10:46 -07:00
parent c0970aeb4e
commit 16c9c8f9b4
1 changed files with 6 additions and 2 deletions

View File

@ -34,7 +34,11 @@ namespace LocalExplorer
//Collect up the path //Collect up the path
//the replace function is here to trim out the arg as it //the replace function is here to trim out the arg as it
//comes in from the url protocol handler //comes in from the url protocol handler
string path = args[0].Replace("localexplorer:", "").Replace("%5C", "\\"); ; string path = args[0].Replace("localexplorer:", "").Replace("%5C", "\\");
//If there is a space in the path as it comes from the URL
//protocol handler, replace it with an actual space.
path = path.Replace("%20", " ");
WriteOutputFile($"arg passed: {path}"); WriteOutputFile($"arg passed: {path}");
@ -72,7 +76,7 @@ namespace LocalExplorer
// comment this out to debug the program // comment this out to debug the program
return; return;
StreamWriter outFile = new StreamWriter(@"C:\Windows\ISD\OUTPUT.txt", true); StreamWriter outFile = new StreamWriter(@"C:\LocalExplorer\OUTPUT.txt", true);
outFile.WriteLine(debugLine); outFile.WriteLine(debugLine);
outFile.Close(); outFile.Close();
} }