From 863dfa81e1876aac38153189fad2550527eb8e77 Mon Sep 17 00:00:00 2001 From: DanielSvoboda Date: Thu, 12 Oct 2023 01:56:10 -0300 Subject: [PATCH] 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. --- src/yuzu/main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 1c25f657b9..1d7df8fcea 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -2882,7 +2882,14 @@ void GMainWindow::OnGameListCreateShortcut(u64 program_id, const std::string& ga case GameListShortcutTarget::Applications: { const QString applications_path = QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation); - target_directory = applications_path.toUtf8().toStdString(); + 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(); + } break; } default: