From ebee73cb8a9c14246b97bdf62552d1aee7786b2a Mon Sep 17 00:00:00 2001 From: TheCakeIsNaOH Date: Sat, 18 Sep 2021 13:49:08 -0500 Subject: [PATCH] (#2369) Do not trim forward slash from assembly path on Linux Prevents the absolute path to the current assembly from being converted to a relative path by the removal of the first forward slash. Applicable to non-windows platforms, leaves Windows alone. Co-Authored-By: Kim J. Nordmo <1474648+AdmiringWorm@users.noreply.github.com> --- src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs index 023d2abee7..ed9bc6604e 100644 --- a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs @@ -180,7 +180,7 @@ public string get_executable_path(string executableName) public string get_current_assembly_path() { - return Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", string.Empty); + return Assembly.GetExecutingAssembly().CodeBase.Replace(Platform.get_platform() == PlatformType.Windows ? "file:///" : "file://", string.Empty); } #endregion