Skip to content

Commit 7ba0258

Browse files
committed
app: fix installation dir calculation
On Windows, when invoked as a partial name (e.g., `manager`) our command line argv[0] is just a file name, not a full file path! We incorrectly assumed that `Environment.GetCommandLineArgs()[0]` was always absolute! We should instead use `AppContext.BaseDirectory` that, in all circumstances tested, all on TFMs and OSs, all publish options, and as a .NET tool... returns the expected full, absolute path to the installation directory.
1 parent 4851182 commit 7ba0258

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/shared/Core/ApplicationBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public static string GetEntryApplicationPath()
9191

9292
public static string GetInstallationDirectory()
9393
{
94-
return Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]);
94+
return AppContext.BaseDirectory;
9595
}
9696

9797
/// <summary>

0 commit comments

Comments
 (0)