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

View file

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