From 30c73fbdf29ff8e6f36641f4b4e271c7974ed88e Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 21 Jul 2023 17:47:45 +0400 Subject: [PATCH] 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. --- Telegram/SourceFiles/platform/linux/specific_linux.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 9fdb7a914..e53ac78b0 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -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());