aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-11-14 18:37:24 +0100
committerSefa Eyeoglu <contact@scrumplex.net>2022-11-14 18:38:12 +0100
commite14b998da3850e43abf2606064d6b0ddebbf0025 (patch)
tree3e25b4fd0fe8e45825b9b09624c8f6308b4c5397
parent2c9452efaf33cb22dbc29a4c6117a646f0de943f (diff)
downloadPrismLauncher-e14b998da3850e43abf2606064d6b0ddebbf0025.tar.gz
PrismLauncher-e14b998da3850e43abf2606064d6b0ddebbf0025.tar.bz2
PrismLauncher-e14b998da3850e43abf2606064d6b0ddebbf0025.zip
refactor: improve readability
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
-rw-r--r--launcher/ui/MainWindow.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp
index 9375039b..e1ac9551 100644
--- a/launcher/ui/MainWindow.cpp
+++ b/launcher/ui/MainWindow.cpp
@@ -1949,16 +1949,24 @@ void MainWindow::on_actionClearMetadata_triggered()
}
#ifdef Q_OS_MAC
-void MainWindow::on_actionAddToPATH_triggered() {
+void MainWindow::on_actionAddToPATH_triggered()
+{
auto binaryPath = APPLICATION->applicationFilePath();
-
- qDebug() << "Symlinking" << binaryPath << "to /usr/local/bin/prism";
- auto outcome = QProcess::execute("/usr/bin/osascript", QStringList()<< "-e" << tr("do shell script \"mkdir -p /usr/local/bin && ln -sf '%1' '/usr/local/bin/prismlauncher'\" with administrator privileges").arg(binaryPath));
-
+ auto targetPath = QString("/usr/local/bin/%1").arg(BuildConfig.LAUNCHER_APP_BINARY_NAME);
+ qDebug() << "Symlinking" << binaryPath << "to" << targetPath;
+
+ QStringList args;
+ args << "-e";
+ args << QString("do shell script \"mkdir -p /usr/local/bin && ln -sf '%1' '%2'\" with administrator privileges")
+ .arg(binaryPath, targetPath);
+ auto outcome = QProcess::execute("/usr/bin/osascript", args);
if (!outcome) {
- QMessageBox::information(this, tr("Added Prism to PATH"), tr("Prism was successfully added to your PATH. You can now run it with `prismlauncher` in your Terminal. Enjoy!"));
+ QMessageBox::information(this, tr("Successfully added %1 to PATH").arg(BuildConfig.LAUNCHER_DISPLAYNAME),
+ tr("%1 was successfully added to your PATH. You can now start it by running `%2`.")
+ .arg(BuildConfig.LAUNCHER_DISPLAYNAME, BuildConfig.LAUNCHER_APP_BINARY_NAME));
} else {
- QMessageBox::critical(this, tr("Failed to add Prism to PATH"), tr("Failed to add Prism to PATH :("));
+ QMessageBox::critical(this, tr("Failed to add %1 to PATH").arg(BuildConfig.LAUNCHER_DISPLAYNAME),
+ tr("An error occurred while trying to add %1 to PATH").arg(BuildConfig.LAUNCHER_DISPLAYNAME));
}
}
#endif