mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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();
|
: (cExeDir() + u"Updater"_q)).toStdString();
|
||||||
|
|
||||||
std::vector<std::string> argumentsList;
|
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())
|
argumentsList.push_back((justRelaunch && !arguments().isEmpty())
|
||||||
? arguments().first().toStdString()
|
? arguments().first().toStdString()
|
||||||
: binaryPath);
|
: binaryPath);
|
||||||
|
@ -104,6 +109,7 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
|
||||||
// pkexec needs an alive parent
|
// pkexec needs an alive parent
|
||||||
if (writeProtectedUpdate) {
|
if (writeProtectedUpdate) {
|
||||||
if (!GLib::spawn_sync(
|
if (!GLib::spawn_sync(
|
||||||
|
initialWorkingDir().toStdString(),
|
||||||
argumentsList,
|
argumentsList,
|
||||||
std::nullopt,
|
std::nullopt,
|
||||||
GLib::SpawnFlags::SEARCH_PATH_,
|
GLib::SpawnFlags::SEARCH_PATH_,
|
||||||
|
@ -119,6 +125,7 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return GLib::spawn_async(
|
return GLib::spawn_async(
|
||||||
|
initialWorkingDir().toStdString(),
|
||||||
argumentsList,
|
argumentsList,
|
||||||
std::nullopt,
|
std::nullopt,
|
||||||
GLib::SpawnFlags::FILE_AND_ARGV_ZERO_,
|
GLib::SpawnFlags::FILE_AND_ARGV_ZERO_,
|
||||||
|
|
Loading…
Add table
Reference in a new issue