Update Program.cs
Replace / with \ to support unc on links that require / If URL contains #, strip it out. Add runtime configurable DEBUG property
This commit is contained in:
parent
c40cefb363
commit
f10c14253c
16
Program.cs
16
Program.cs
@ -49,16 +49,24 @@ namespace LocalExplorer
|
||||
//protocol handler, replace it with an actual space.
|
||||
path = path.Replace("%20", " ");
|
||||
|
||||
//Replace / with \ to support proper unc
|
||||
path = path.Replace("/", "\\");
|
||||
|
||||
//If the URL contains a #,
|
||||
//Trim out everything after # including the #
|
||||
if(path.Contains("#"))
|
||||
{ path = path.Substring(0, path.IndexOf("#")); }
|
||||
|
||||
WriteOutputFile($"arg passed: {path}");
|
||||
|
||||
//Determine if file or directory.
|
||||
|
||||
//Check to see if the directory or file exists.
|
||||
if (Directory.Exists(path))
|
||||
{ bDirectoryExists = true; }
|
||||
{ bDirectoryExists = true; }
|
||||
|
||||
if (!bDirectoryExists && File.Exists(path))
|
||||
{ bFileExists = true; }
|
||||
{ bFileExists = true; }
|
||||
|
||||
//if the directory exists pop it open.
|
||||
if (bDirectoryExists)
|
||||
@ -165,8 +173,8 @@ namespace LocalExplorer
|
||||
}
|
||||
private static void WriteOutputFile(string debugLine)
|
||||
{
|
||||
// comment this out to debug the program
|
||||
return;
|
||||
if (!Properties.Settings.Default.DEBUG)
|
||||
{ return; }
|
||||
|
||||
StreamWriter outFile = new StreamWriter(@"C:\LocalExplorer\OUTPUT.txt", true);
|
||||
outFile.WriteLine(debugLine);
|
||||
|
Loading…
x
Reference in New Issue
Block a user