Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/StubExecutable/StubExecutable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions src/Update/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down