aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
authorADudeCalledLeo <7997354+Leo40Git@users.noreply.github.com>2022-11-13 15:47:37 +0200
committerADudeCalledLeo <7997354+Leo40Git@users.noreply.github.com>2022-11-13 15:47:37 +0200
commit69bbb2932848fe7509f91623bac2a648ce594ad7 (patch)
tree972da0cc5830acda3b559b27f1ec7798b44522da /launcher
parent5322155b19e68b44e879512cf46ee152045dc1b1 (diff)
downloadPrismLauncher-69bbb2932848fe7509f91623bac2a648ce594ad7.tar.gz
PrismLauncher-69bbb2932848fe7509f91623bac2a648ce594ad7.tar.bz2
PrismLauncher-69bbb2932848fe7509f91623bac2a648ce594ad7.zip
Mac: attempt 2
- create .command files instead of .sh - fix shortcuts not working if path to Prism Launcher contains spaces - fix path to executable in shortcutss - add check for running from extracted folder (prevents creating shortcuts) Signed-off-by: ADudeCalledLeo <7997354+Leo40Git@users.noreply.github.com>
Diffstat (limited to 'launcher')
-rw-r--r--launcher/FileSystem.cpp7
-rw-r--r--launcher/ui/MainWindow.cpp11
2 files changed, 10 insertions, 8 deletions
diff --git a/launcher/FileSystem.cpp b/launcher/FileSystem.cpp
index 7a1861e7..80715498 100644
--- a/launcher/FileSystem.cpp
+++ b/launcher/FileSystem.cpp
@@ -343,7 +343,7 @@ QString getDesktopDir()
bool createShortcut(QString destination, QString target, QStringList args, QString name, QString icon)
{
#if defined(Q_OS_MACOS)
- destination += ".sh";
+ destination += ".command";
QFile f(destination);
f.open(QIODevice::WriteOnly | QIODevice::Text);
@@ -355,8 +355,9 @@ bool createShortcut(QString destination, QString target, QStringList args, QStri
stream << "#!/bin/bash"
<< "\n";
- stream << target
- << " "
+ stream << "\""
+ << target
+ << "\" "
<< argstring
<< "\n";
diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp
index aedd9e4f..17371149 100644
--- a/launcher/ui/MainWindow.cpp
+++ b/launcher/ui/MainWindow.cpp
@@ -2100,13 +2100,14 @@ void MainWindow::on_actionCreateInstanceShortcut_triggered()
}
#if defined(Q_OS_MACOS)
- // handle macOS bundle weirdness
- QFileInfo appFileInfo(QApplication::applicationFilePath());
- QString appName = appFileInfo.baseName();
- QString exeName = FS::PathCombine(appFileInfo.filePath(), "Contents/MacOS/" + appName);
+ QString appPath = QApplication::applicationFilePath();
+ if (appPath.startsWith("/private/var")) {
+ QMessageBox::critical(this, tr("Create instance shortcut"), tr("The launcher is in the folder it was extracted from, therefore it cannot create shortcuts."));
+ return;
+ }
if (FS::createShortcut(FS::PathCombine(desktopPath, m_selectedInstance->name()),
- exeName, { "--launch", m_selectedInstance->id() }, m_selectedInstance->name(), "")) {
+ appPath, { "--launch", m_selectedInstance->id() }, m_selectedInstance->name(), "")) {
QMessageBox::information(this, tr("Create instance shortcut"), tr("Created a shortcut to this instance on your desktop!"));
}
else