Update main.cpp
This code will attempt to use QStandardPaths to find the applications directory. If that fails, it will resort to using the ~/.local/share/applications directory, which is a common location for application shortcuts in Linux.
This commit is contained in:
parent
32da76d4f2
commit
863dfa81e1
1 changed files with 8 additions and 1 deletions
|
@ -2882,7 +2882,14 @@ void GMainWindow::OnGameListCreateShortcut(u64 program_id, const std::string& ga
|
||||||
case GameListShortcutTarget::Applications: {
|
case GameListShortcutTarget::Applications: {
|
||||||
const QString applications_path =
|
const QString applications_path =
|
||||||
QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation);
|
QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation);
|
||||||
|
if (applications_path.isEmpty()) {
|
||||||
|
const char* home = std::getenv("HOME");
|
||||||
|
if (home != nullptr) {
|
||||||
|
target_directory = std::filesystem::path(home) / ".local/share/applications";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
target_directory = applications_path.toUtf8().toStdString();
|
target_directory = applications_path.toUtf8().toStdString();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue