diff --git a/src/StubExecutable/StubExecutable.cpp b/src/StubExecutable/StubExecutable.cpp index a723a9b5c..1d26fbd99 100644 --- a/src/StubExecutable/StubExecutable.cpp +++ b/src/StubExecutable/StubExecutable.cpp @@ -103,8 +103,13 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = nCmdShow; + TCHAR cwd[MAX_PATH]; + GetCurrentDirectory(MAX_PATH, cwd); + std::wstring cmdLine(L"\""); cmdLine += fullPath; + cmdLine += L"\" --squirrel-cwd=\""; + cmdLine += cwd; cmdLine += L"\" "; cmdLine += lpCmdLine; diff --git a/src/Update/Program.cs b/src/Update/Program.cs index d9a0af72b..18ab2ac0a 100644 --- a/src/Update/Program.cs +++ b/src/Update/Program.cs @@ -497,8 +497,9 @@ public void ProcessStart(string exeName, string arguments, bool shouldWait) if (shouldWait) waitForParentToExit(); try { - this.Log().Info("About to launch: '{0}': {1}", targetExe.FullName, arguments ?? ""); - Process.Start(new ProcessStartInfo(targetExe.FullName, arguments ?? "") { WorkingDirectory = Path.GetDirectoryName(targetExe.FullName) }); + arguments = string.IsNullOrEmpty(arguments) ? $"--squirrel-cwd=\"{Environment.CurrentDirectory}\"" : $"{arguments} --squirrel-cwd=\"{Environment.CurrentDirectory}\""; + this.Log().Info("About to launch: '{0}': {1}", targetExe.FullName, arguments); + Process.Start(new ProcessStartInfo(targetExe.FullName, arguments) { WorkingDirectory = Path.GetDirectoryName(targetExe.FullName) }); } catch (Exception ex) { this.Log().ErrorException("Failed to start process", ex); }