NOISSUE shortcut creation: enclose paths in quotes

This commit is contained in:
arthomnix 2022-07-06 08:03:04 +01:00
parent 79910e3542
commit 518b19e667

View File

@ -129,7 +129,7 @@ void CreateShortcutDialog::updateDialogState()
QString CreateShortcutDialog::getLaunchCommand() QString CreateShortcutDialog::getLaunchCommand()
{ {
return QDir::toNativeSeparators(QCoreApplication::applicationFilePath()) return "\"" + QDir::toNativeSeparators(QCoreApplication::applicationFilePath()) + "\""
+ getLaunchArgs(); + getLaunchArgs();
} }
@ -155,7 +155,7 @@ void CreateShortcutDialog::createShortcut()
if (ui->createScriptCheckBox->isChecked()) if (ui->createScriptCheckBox->isChecked())
{ {
shortcutText = "#!/bin/sh\n" shortcutText = "#!/bin/sh\n"
"cd " + QCoreApplication::applicationDirPath() + "\n" "cd \"" + QCoreApplication::applicationDirPath() + "\"\n"
+ getLaunchCommand() + " &\n"; + getLaunchCommand() + " &\n";
} else } else
// freedesktop.org desktop entry // freedesktop.org desktop entry
@ -179,7 +179,7 @@ void CreateShortcutDialog::createShortcut()
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
// Windows batch script implementation // Windows batch script implementation
shortcutText = "@ECHO OFF\r\n" shortcutText = "@ECHO OFF\r\n"
"CD " + QDir::toNativeSeparators(QCoreApplication::applicationDirPath()) + "\r\n" "CD \"" + QDir::toNativeSeparators(QCoreApplication::applicationDirPath()) + "\"\r\n"
"START /B " + getLaunchCommand() + "\r\n"; "START /B " + getLaunchCommand() + "\r\n";
#endif #endif
QFile shortcutFile(ui->shortcutPath->text()); QFile shortcutFile(ui->shortcutPath->text());