diff options
| author | 2023-10-15 14:44:23 -0300 | |
|---|---|---|
| committer | 2023-10-15 14:44:23 -0300 | |
| commit | 4d4fe69223bd6cd053cbd2088e5925fb653a12d3 (patch) | |
| tree | 5559faeafc73e93fc652588e6556e6bb97fb4d6b /src/common | |
| parent | Fixes and improvements (diff) | |
| download | yuzu-4d4fe69223bd6cd053cbd2088e5925fb653a12d3.tar.gz yuzu-4d4fe69223bd6cd053cbd2088e5925fb653a12d3.tar.xz yuzu-4d4fe69223bd6cd053cbd2088e5925fb653a12d3.zip | |
Unnecessary feature removed
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/fs/path_util.cpp | 70 | ||||
| -rw-r--r-- | src/common/fs/path_util.h | 15 |
2 files changed, 1 insertions, 84 deletions
diff --git a/src/common/fs/path_util.cpp b/src/common/fs/path_util.cpp index f030939ce..bccf953e4 100644 --- a/src/common/fs/path_util.cpp +++ b/src/common/fs/path_util.cpp | |||
| @@ -348,76 +348,6 @@ fs::path GetBundleDirectory() { | |||
| 348 | 348 | ||
| 349 | #endif | 349 | #endif |
| 350 | 350 | ||
| 351 | fs::path GetDesktopPath() { | ||
| 352 | #if defined(_WIN32) | ||
| 353 | PWSTR DesktopPath = nullptr; | ||
| 354 | |||
| 355 | if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Desktop, 0, NULL, &DesktopPath))) { | ||
| 356 | std::wstring wideDesktopPath(DesktopPath); | ||
| 357 | CoTaskMemFree(DesktopPath); | ||
| 358 | |||
| 359 | // UTF-16 filesystem lib to UTF-8 is broken, so we need to convert to UTF-8 with the with | ||
| 360 | // the Windows library (Filesystem converts the strings literally). | ||
| 361 | return fs::path{Common::UTF16ToUTF8(wideDesktopPath)}; | ||
| 362 | } else { | ||
| 363 | LOG_ERROR(Common_Filesystem, | ||
| 364 | "[GetDesktopPath] Failed to get the path to the desktop directory"); | ||
| 365 | } | ||
| 366 | return fs::path{}; | ||
| 367 | #else | ||
| 368 | fs::path shortcut_path{}; | ||
| 369 | |||
| 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 | } | ||
| 381 | } | ||
| 382 | |||
| 383 | LOG_ERROR(Common_Filesystem, | ||
| 384 | "[GetDesktopPath] Failed to get the path to the desktop directory"); | ||
| 385 | |||
| 386 | return shortcut_path; | ||
| 387 | #endif | ||
| 388 | } | ||
| 389 | |||
| 390 | fs::path GetAppsShortcutsPath() { | ||
| 391 | #if defined(_WIN32) | ||
| 392 | PWSTR AppShortcutsPath = nullptr; | ||
| 393 | |||
| 394 | if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_CommonPrograms, 0, NULL, &AppShortcutsPath))) { | ||
| 395 | std::wstring wideAppShortcutsPath(AppShortcutsPath); | ||
| 396 | CoTaskMemFree(AppShortcutsPath); | ||
| 397 | |||
| 398 | // UTF-16 filesystem lib to UTF-8 is broken, so we need to convert to UTF-8 with the with | ||
| 399 | // the Windows library (Filesystem converts the strings literally). | ||
| 400 | return fs::path{Common::UTF16ToUTF8(wideAppShortcutsPath)}; | ||
| 401 | } else { | ||
| 402 | LOG_ERROR(Common_Filesystem, | ||
| 403 | "[GetAppsShortcutsPath] Failed to get the path to the App Shortcuts directory"); | ||
| 404 | } | ||
| 405 | |||
| 406 | return fs::path{}; | ||
| 407 | #else | ||
| 408 | fs::path shortcut_path = GetHomeDirectory() / ".local/share/applications"; | ||
| 409 | if (!fs::exists(shortcut_path)) { | ||
| 410 | shortcut_path = std::filesystem::path("/usr/share/applications"); | ||
| 411 | if (!fs::exists(shortcut_path)) { | ||
| 412 | LOG_ERROR(Common_Filesystem, | ||
| 413 | "[GetAppsShortcutsPath] Failed to get the path to the App Shortcuts " | ||
| 414 | "directory"); | ||
| 415 | } | ||
| 416 | } | ||
| 417 | return fs::path{}; | ||
| 418 | #endif | ||
| 419 | } | ||
| 420 | |||
| 421 | // vvvvvvvvvv Deprecated vvvvvvvvvv // | 351 | // vvvvvvvvvv Deprecated vvvvvvvvvv // |
| 422 | 352 | ||
| 423 | std::string_view RemoveTrailingSlash(std::string_view path) { | 353 | std::string_view RemoveTrailingSlash(std::string_view path) { |
diff --git a/src/common/fs/path_util.h b/src/common/fs/path_util.h index b88a388d1..63801c924 100644 --- a/src/common/fs/path_util.h +++ b/src/common/fs/path_util.h | |||
| @@ -244,6 +244,7 @@ void SetYuzuPath(YuzuPath yuzu_path, const Path& new_path) { | |||
| 244 | * @returns The path of the current user's %APPDATA% directory. | 244 | * @returns The path of the current user's %APPDATA% directory. |
| 245 | */ | 245 | */ |
| 246 | [[nodiscard]] std::filesystem::path GetAppDataRoamingDirectory(); | 246 | [[nodiscard]] std::filesystem::path GetAppDataRoamingDirectory(); |
| 247 | |||
| 247 | #else | 248 | #else |
| 248 | 249 | ||
| 249 | /** | 250 | /** |
| @@ -274,20 +275,6 @@ void SetYuzuPath(YuzuPath yuzu_path, const Path& new_path) { | |||
| 274 | 275 | ||
| 275 | #endif | 276 | #endif |
| 276 | 277 | ||
| 277 | /** | ||
| 278 | * Gets the path of the current user's desktop directory. | ||
| 279 | * | ||
| 280 | * @returns The path of the current user's desktop directory. | ||
| 281 | */ | ||
| 282 | [[nodiscard]] std::filesystem::path GetDesktopPath(); | ||
| 283 | |||
| 284 | /** | ||
| 285 | * Gets the path of the current user's apps directory. | ||
| 286 | * | ||
| 287 | * @returns The path of the current user's apps directory. | ||
| 288 | */ | ||
| 289 | [[nodiscard]] std::filesystem::path GetAppsShortcutsPath(); | ||
| 290 | |||
| 291 | // vvvvvvvvvv Deprecated vvvvvvvvvv // | 278 | // vvvvvvvvvv Deprecated vvvvvvvvvv // |
| 292 | 279 | ||
| 293 | // Removes the final '/' or '\' if one exists | 280 | // Removes the final '/' or '\' if one exists |