mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 22:57:11 +02:00
Restore initial working directory on restart
So executable path computation still works for the new instance on systems deducing it by argv0
This commit is contained in:
parent
cc19928977
commit
b35fff01b0
1 changed files with 8 additions and 1 deletions
|
@ -53,7 +53,12 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
|
|||
: (cExeDir() + u"Updater"_q)).toStdString();
|
||||
|
||||
std::vector<std::string> argumentsList;
|
||||
argumentsList.push_back(writeProtectedUpdate ? "pkexec" : binaryPath);
|
||||
if (writeProtectedUpdate) {
|
||||
argumentsList.push_back("pkexec");
|
||||
argumentsList.push_back("--keep-cwd");
|
||||
} else {
|
||||
argumentsList.push_back(binaryPath);
|
||||
}
|
||||
argumentsList.push_back((justRelaunch && !arguments().isEmpty())
|
||||
? arguments().first().toStdString()
|
||||
: binaryPath);
|
||||
|
@ -104,6 +109,7 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
|
|||
// pkexec needs an alive parent
|
||||
if (writeProtectedUpdate) {
|
||||
if (!GLib::spawn_sync(
|
||||
initialWorkingDir().toStdString(),
|
||||
argumentsList,
|
||||
std::nullopt,
|
||||
GLib::SpawnFlags::SEARCH_PATH_,
|
||||
|
@ -119,6 +125,7 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
|
|||
}
|
||||
|
||||
return GLib::spawn_async(
|
||||
initialWorkingDir().toStdString(),
|
||||
argumentsList,
|
||||
std::nullopt,
|
||||
GLib::SpawnFlags::FILE_AND_ARGV_ZERO_,
|
||||
|
|
Loading…
Add table
Reference in a new issue