diff options
| author | 2023-10-15 03:16:29 -0300 | |
|---|---|---|
| committer | 2023-10-15 03:16:29 -0300 | |
| commit | 0a75519ab590e250c94dc04b3f6072a69ef7e96b (patch) | |
| tree | 54deace8df1a942d1c7f04a80b13c56714a59ff7 /src/common/fs/path_util.cpp | |
| parent | Improved shortcut: add games in applist for Windows, question for start game ... (diff) | |
| download | yuzu-0a75519ab590e250c94dc04b3f6072a69ef7e96b.tar.gz yuzu-0a75519ab590e250c94dc04b3f6072a69ef7e96b.tar.xz yuzu-0a75519ab590e250c94dc04b3f6072a69ef7e96b.zip | |
Fixes and improvements
Diffstat (limited to 'src/common/fs/path_util.cpp')
| -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() { | |||
| 363 | LOG_ERROR(Common_Filesystem, | 363 | LOG_ERROR(Common_Filesystem, |
| 364 | "[GetDesktopPath] Failed to get the path to the desktop directory"); | 364 | "[GetDesktopPath] Failed to get the path to the desktop directory"); |
| 365 | } | 365 | } |
| 366 | return fs::path{}; | ||
| 366 | #else | 367 | #else |
| 367 | fs::path shortcut_path = GetHomeDirectory() / "Desktop"; | 368 | fs::path shortcut_path{}; |
| 368 | if (fs::exists(shortcut_path)) { | 369 | |
| 369 | return shortcut_path; | 370 | // Array of possible desktop |
| 371 | std::vector<std::string> desktop_paths = { | ||
| 372 | "Desktop", "Escritorio", "Bureau", "Skrivebord", "Plocha", | ||
| 373 | "Skrivbord", "Desktop", "Рабочий стол", "Pulpit", "Área de Trabalho", | ||
| 374 | "Робочий стіл", "Bureaublad", "デスクトップ", "桌面", "Pöytä", | ||
| 375 | "바탕 화면", "바탕 화면", "سطح المكتب", "دسکتاپ", "שולחן עבודה"}; | ||
| 376 | |||
| 377 | for (auto& path : desktop_paths) { | ||
| 378 | if (fs::exists(GetHomeDirectory() / path)) { | ||
| 379 | return path; | ||
| 380 | } | ||
| 370 | } | 381 | } |
| 382 | |||
| 383 | LOG_ERROR(Common_Filesystem, | ||
| 384 | "[GetDesktopPath] Failed to get the path to the desktop directory"); | ||
| 385 | |||
| 386 | return shortcut_path; | ||
| 371 | #endif | 387 | #endif |
| 372 | return fs::path{}; | ||
| 373 | } | 388 | } |
| 374 | 389 | ||
| 375 | fs::path GetAppsShortcutsPath() { | 390 | fs::path GetAppsShortcutsPath() { |
| @@ -387,16 +402,20 @@ fs::path GetAppsShortcutsPath() { | |||
| 387 | LOG_ERROR(Common_Filesystem, | 402 | LOG_ERROR(Common_Filesystem, |
| 388 | "[GetAppsShortcutsPath] Failed to get the path to the App Shortcuts directory"); | 403 | "[GetAppsShortcutsPath] Failed to get the path to the App Shortcuts directory"); |
| 389 | } | 404 | } |
| 405 | |||
| 406 | return fs::path{}; | ||
| 390 | #else | 407 | #else |
| 391 | fs::path shortcut_path = GetHomeDirectory() / ".local/share/applications"; | 408 | fs::path shortcut_path = GetHomeDirectory() / ".local/share/applications"; |
| 392 | if (!fs::exists(shortcut_path)) { | 409 | if (!fs::exists(shortcut_path)) { |
| 393 | shortcut_path = std::filesystem::path("/usr/share/applications"); | 410 | shortcut_path = std::filesystem::path("/usr/share/applications"); |
| 394 | return shortcut_path; | 411 | if (!fs::exists(shortcut_path)) { |
| 395 | } else { | 412 | LOG_ERROR(Common_Filesystem, |
| 396 | return shortcut_path; | 413 | "[GetAppsShortcutsPath] Failed to get the path to the App Shortcuts " |
| 414 | "directory"); | ||
| 415 | } | ||
| 397 | } | 416 | } |
| 398 | #endif | ||
| 399 | return fs::path{}; | 417 | return fs::path{}; |
| 418 | #endif | ||
| 400 | } | 419 | } |
| 401 | 420 | ||
| 402 | // vvvvvvvvvv Deprecated vvvvvvvvvv // | 421 | // vvvvvvvvvv Deprecated vvvvvvvvvv // |