Fix D-Bus service with non-standard workdir or backslash in the path

Working dir not set leads to unrelevant instance being launched with unrelevant bus name and entire launchf fails.

D-Bus service files also don't need backslash escaping unlike the .desktop files.
This commit is contained in:
Ilya Fedin 2023-07-21 17:47:45 +04:00 committed by John Preston
parent 2cc0faa5b3
commit 30c73fbdf2
1 changed files with 7 additions and 3 deletions

View File

@ -346,12 +346,16 @@ bool GenerateServiceFile(bool silent = false) {
"Name",
QGuiApplication::desktopFileName().toStdString());
QStringList exec;
exec.append(executable);
if (Core::Launcher::Instance().customWorkingDir()) {
exec.append(u"-workdir"_q);
exec.append(cWorkingDir());
}
target->set_string(
group,
"Exec",
KShell::joinArgs({ executable }).replace(
'\\',
qstr("\\\\")).toStdString());
KShell::joinArgs(exec).toStdString());
try {
target->save_to_file(targetFile.toStdString());