diff options
author | boludoz <francomaro@gmail.com> | 2023-10-15 08:16:29 +0200 |
---|---|---|
committer | boludoz <francomaro@gmail.com> | 2023-10-15 08:16:29 +0200 |
commit | 0a75519ab590e250c94dc04b3f6072a69ef7e96b (patch) | |
tree | 54deace8df1a942d1c7f04a80b13c56714a59ff7 /src/common | |
parent | Improved shortcut: add games in applist for Windows, question for start game at fullscreen & better unicode support for some Windows path funcs. (diff) | |
download | yuzu-0a75519ab590e250c94dc04b3f6072a69ef7e96b.tar yuzu-0a75519ab590e250c94dc04b3f6072a69ef7e96b.tar.gz yuzu-0a75519ab590e250c94dc04b3f6072a69ef7e96b.tar.bz2 yuzu-0a75519ab590e250c94dc04b3f6072a69ef7e96b.tar.lz yuzu-0a75519ab590e250c94dc04b3f6072a69ef7e96b.tar.xz yuzu-0a75519ab590e250c94dc04b3f6072a69ef7e96b.tar.zst yuzu-0a75519ab590e250c94dc04b3f6072a69ef7e96b.zip |
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/fs/path_util.cpp | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/common/fs/path_util.cpp b/src/common/fs/path_util.cpp index a461161ed..f030939ce 100644 --- a/src/common/fs/path_util.cpp +++ b/src/common/fs/path_util.cpp @@ -363,13 +363,28 @@ fs::path GetDesktopPath() { LOG_ERROR(Common_Filesystem, "[GetDesktopPath] Failed to get the path to the desktop directory"); } + return fs::path{}; #else - fs::path shortcut_path = GetHomeDirectory() / "Desktop"; - if (fs::exists(shortcut_path)) { - return shortcut_path; + fs::path shortcut_path{}; + + // Array of possible desktop + std::vector<std::string> desktop_paths = { + "Desktop", "Escritorio", "Bureau", "Skrivebord", "Plocha", + "Skrivbord", "Desktop", "Рабочий стол", "Pulpit", "Área de Trabalho", + "Робочий стіл", "Bureaublad", "デスクトップ", "桌面", "Pöytä", + "바탕 화면", "바탕 화면", "سطح المكتب", "دسکتاپ", "שולחן עבודה"}; + + for (auto& path : desktop_paths) { + if (fs::exists(GetHomeDirectory() / path)) { + return path; + } } + + LOG_ERROR(Common_Filesystem, + "[GetDesktopPath] Failed to get the path to the desktop directory"); + + return shortcut_path; #endif - return fs::path{}; } fs::path GetAppsShortcutsPath() { @@ -387,16 +402,20 @@ fs::path GetAppsShortcutsPath() { LOG_ERROR(Common_Filesystem, "[GetAppsShortcutsPath] Failed to get the path to the App Shortcuts directory"); } + + return fs::path{}; #else fs::path shortcut_path = GetHomeDirectory() / ".local/share/applications"; if (!fs::exists(shortcut_path)) { shortcut_path = std::filesystem::path("/usr/share/applications"); - return shortcut_path; - } else { - return shortcut_path; + if (!fs::exists(shortcut_path)) { + LOG_ERROR(Common_Filesystem, + "[GetAppsShortcutsPath] Failed to get the path to the App Shortcuts " + "directory"); + } } -#endif return fs::path{}; +#endif } // vvvvvvvvvv Deprecated vvvvvvvvvv // |