add macos support for shortcuts
Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com>
This commit is contained in:
parent
7c60f375f3
commit
8bb35f5b0b
2 changed files with 13 additions and 10 deletions
|
@ -1658,6 +1658,8 @@ void MainWindow::on_actionCreateInstanceShortcutOther_triggered()
|
|||
if (shortcutFilePath.isEmpty())
|
||||
return; // file dialog canceled by user
|
||||
|
||||
if(shortcutFilePath.endsWith(extension))
|
||||
shortcutFilePath = shortcutFilePath.mid(0, shortcutFilePath.length() - extension.length());
|
||||
createInstanceShortcut(shortcutFilePath);
|
||||
QMessageBox::information(this, tr("Create instance shortcut"), tr("Created a shortcut to this instance!"));
|
||||
}
|
||||
|
@ -1700,6 +1702,16 @@ void MainWindow::on_actionCreateInstanceShortcutApplications_triggered()
|
|||
return;
|
||||
}
|
||||
|
||||
#if defined(Q_OS_MACOS) || defined(Q_OS_WIN)
|
||||
applicationsDir = FS::PathCombine(applicationsDir, BuildConfig.LAUNCHER_DISPLAYNAME + " Instances");
|
||||
|
||||
QDir applicationsDirQ(applicationsDir);
|
||||
if (!applicationsDirQ.mkpath(".")) {
|
||||
QMessageBox::critical(this, tr("Create instance shortcut"), tr("Failed to create instances folder in applications folder!"));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
QString shortcutFilePath = FS::PathCombine(applicationsDir, FS::RemoveInvalidFilenameChars(m_selectedInstance->name()));
|
||||
createInstanceShortcut(shortcutFilePath);
|
||||
QMessageBox::information(this, tr("Create instance shortcut"), tr("Created a shortcut to this instance in your applications folder!"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue