Update main.cpp
This commit is contained in:
parent
0479b0b927
commit
7961fe6189
1 changed files with 25 additions and 30 deletions
|
@ -2872,36 +2872,31 @@ void GMainWindow::OnGameListCreateShortcut(u64 program_id, const std::string& ga
|
||||||
|
|
||||||
std::filesystem::path target_directory{};
|
std::filesystem::path target_directory{};
|
||||||
|
|
||||||
// Determine target directory for shortcut
|
switch (target) {
|
||||||
if (target == GameListShortcutTarget::Desktop) {
|
case GameListShortcutTarget::Desktop: {
|
||||||
const auto desktop_path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
const QString desktopPath =
|
||||||
target_directory = desktop_path.toUtf8().toStdString();
|
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||||
const QDir dir(QString::fromStdString(target_directory.generic_string()));
|
target_directory = desktopPath.toUtf8().toStdString();
|
||||||
if (!dir.exists()) {
|
break;
|
||||||
QMessageBox::critical(
|
}
|
||||||
this, tr("Create Shortcut"),
|
case GameListShortcutTarget::Applications: {
|
||||||
tr("Cannot create shortcut on desktop. Path \"%1\" does not exist.")
|
const QString applicationsPath =
|
||||||
.arg(QString::fromStdString(target_directory.generic_string())),
|
QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation);
|
||||||
QMessageBox::StandardButton::Ok);
|
target_directory = applicationsPath.toUtf8().toStdString();
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
} else if (target == GameListShortcutTarget::Applications) {
|
default:
|
||||||
#if defined(__linux__)
|
return;
|
||||||
QString applicationsPath =
|
}
|
||||||
QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation);
|
|
||||||
target_directory = applicationsPath.toUtf8().toStdString();
|
const QDir dir(QString::fromStdString(target_directory.generic_string()));
|
||||||
QDir dir(QString::fromStdString(target_directory.generic_string()));
|
if (!dir.exists()) {
|
||||||
if (!dir.exists()) {
|
QMessageBox::critical(this, tr("Create Shortcut"),
|
||||||
QMessageBox::critical(
|
tr("Cannot create shortcut. Path \"%1\" does not exist.")
|
||||||
this, tr("Create Shortcut"),
|
.arg(QString::fromStdString(target_directory.generic_string())),
|
||||||
tr("Cannot create shortcut in applications menu. Path \"%1\" "
|
QMessageBox::StandardButton::Ok);
|
||||||
"does not exist and cannot be created.")
|
return;
|
||||||
.arg(QString::fromStdString(target_directory.generic_string())),
|
}
|
||||||
QMessageBox::StandardButton::Ok);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string game_file_name = std::filesystem::path(game_path).filename().string();
|
const std::string game_file_name = std::filesystem::path(game_path).filename().string();
|
||||||
// Determine full paths for icon and shortcut
|
// Determine full paths for icon and shortcut
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue