Skip to content

Commit 3729a41

Browse files
committed
Bug fix: properly send the path to a new process when "run as an admin" button is pressed.
1 parent 2370ee7 commit 3729a41

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/App/Utils/CommandLineParser.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.IO;
2+
using ShowWhatProcessLocksFile.LockFinding.Utils;
23

34
namespace ShowWhatProcessLocksFile.Utils;
45

@@ -23,7 +24,7 @@ public static string GetFileFullName()
2324
throw new Exception($"'{args[1]}' doesn't exist");
2425
}
2526

26-
return args[1];
27+
return PathUtils.ToCanonicalPath(args[1]);
2728
}
2829

2930
private static bool Exists(string path)

src/App/Utils/Elevation.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ internal static class Elevation
99
{
1010
public static void RestartAsAdmin(string path)
1111
{
12+
// some of `\` signs can be interpreted as escape sequences.
13+
path = path.Replace("\\", "/");
14+
1215
new Process
1316
{
1417
StartInfo = new ProcessStartInfo(Assembly.GetExecutingAssembly().Location, $"\"{path}\"")

0 commit comments

Comments
 (0)