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.
|
//protocol handler, replace it with an actual space.
|
||||||
path = path.Replace("%20", " ");
|
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}");
|
WriteOutputFile($"arg passed: {path}");
|
||||||
|
|
||||||
//Determine if file or directory.
|
//Determine if file or directory.
|
||||||
|
|
||||||
//Check to see if the directory or file exists.
|
//Check to see if the directory or file exists.
|
||||||
if (Directory.Exists(path))
|
if (Directory.Exists(path))
|
||||||
{ bDirectoryExists = true; }
|
{ bDirectoryExists = true; }
|
||||||
|
|
||||||
if (!bDirectoryExists && File.Exists(path))
|
if (!bDirectoryExists && File.Exists(path))
|
||||||
{ bFileExists = true; }
|
{ bFileExists = true; }
|
||||||
|
|
||||||
//if the directory exists pop it open.
|
//if the directory exists pop it open.
|
||||||
if (bDirectoryExists)
|
if (bDirectoryExists)
|
||||||
|
@ -165,8 +173,8 @@ namespace LocalExplorer
|
||||||
}
|
}
|
||||||
private static void WriteOutputFile(string debugLine)
|
private static void WriteOutputFile(string debugLine)
|
||||||
{
|
{
|
||||||
// comment this out to debug the program
|
if (!Properties.Settings.Default.DEBUG)
|
||||||
return;
|
{ return; }
|
||||||
|
|
||||||
StreamWriter outFile = new StreamWriter(@"C:\LocalExplorer\OUTPUT.txt", true);
|
StreamWriter outFile = new StreamWriter(@"C:\LocalExplorer\OUTPUT.txt", true);
|
||||||
outFile.WriteLine(debugLine);
|
outFile.WriteLine(debugLine);
|
||||||
|
|
Loading…
Reference in New Issue