diff options
Diffstat (limited to 'src/common/fs')
| -rw-r--r-- | src/common/fs/fs.cpp | 15 | ||||
| -rw-r--r-- | src/common/fs/path_util.cpp | 6 |
2 files changed, 13 insertions, 8 deletions
diff --git a/src/common/fs/fs.cpp b/src/common/fs/fs.cpp index 36e67c145..174aed49b 100644 --- a/src/common/fs/fs.cpp +++ b/src/common/fs/fs.cpp | |||
| @@ -528,38 +528,41 @@ void IterateDirEntriesRecursively(const std::filesystem::path& path, | |||
| 528 | // Generic Filesystem Operations | 528 | // Generic Filesystem Operations |
| 529 | 529 | ||
| 530 | bool Exists(const fs::path& path) { | 530 | bool Exists(const fs::path& path) { |
| 531 | std::error_code ec; | ||
| 531 | #ifdef ANDROID | 532 | #ifdef ANDROID |
| 532 | if (Android::IsContentUri(path)) { | 533 | if (Android::IsContentUri(path)) { |
| 533 | return Android::Exists(path); | 534 | return Android::Exists(path); |
| 534 | } else { | 535 | } else { |
| 535 | return fs::exists(path); | 536 | return fs::exists(path, ec); |
| 536 | } | 537 | } |
| 537 | #else | 538 | #else |
| 538 | return fs::exists(path); | 539 | return fs::exists(path, ec); |
| 539 | #endif | 540 | #endif |
| 540 | } | 541 | } |
| 541 | 542 | ||
| 542 | bool IsFile(const fs::path& path) { | 543 | bool IsFile(const fs::path& path) { |
| 544 | std::error_code ec; | ||
| 543 | #ifdef ANDROID | 545 | #ifdef ANDROID |
| 544 | if (Android::IsContentUri(path)) { | 546 | if (Android::IsContentUri(path)) { |
| 545 | return !Android::IsDirectory(path); | 547 | return !Android::IsDirectory(path); |
| 546 | } else { | 548 | } else { |
| 547 | return fs::is_regular_file(path); | 549 | return fs::is_regular_file(path, ec); |
| 548 | } | 550 | } |
| 549 | #else | 551 | #else |
| 550 | return fs::is_regular_file(path); | 552 | return fs::is_regular_file(path, ec); |
| 551 | #endif | 553 | #endif |
| 552 | } | 554 | } |
| 553 | 555 | ||
| 554 | bool IsDir(const fs::path& path) { | 556 | bool IsDir(const fs::path& path) { |
| 557 | std::error_code ec; | ||
| 555 | #ifdef ANDROID | 558 | #ifdef ANDROID |
| 556 | if (Android::IsContentUri(path)) { | 559 | if (Android::IsContentUri(path)) { |
| 557 | return Android::IsDirectory(path); | 560 | return Android::IsDirectory(path); |
| 558 | } else { | 561 | } else { |
| 559 | return fs::is_directory(path); | 562 | return fs::is_directory(path, ec); |
| 560 | } | 563 | } |
| 561 | #else | 564 | #else |
| 562 | return fs::is_directory(path); | 565 | return fs::is_directory(path, ec); |
| 563 | #endif | 566 | #endif |
| 564 | } | 567 | } |
| 565 | 568 | ||
diff --git a/src/common/fs/path_util.cpp b/src/common/fs/path_util.cpp index 3bbe9ff87..84ed0ad10 100644 --- a/src/common/fs/path_util.cpp +++ b/src/common/fs/path_util.cpp | |||
| @@ -88,8 +88,9 @@ public: | |||
| 88 | fs::path yuzu_path_config; | 88 | fs::path yuzu_path_config; |
| 89 | 89 | ||
| 90 | #ifdef _WIN32 | 90 | #ifdef _WIN32 |
| 91 | #ifdef YUZU_ENABLE_PORTABLE | ||
| 91 | yuzu_path = GetExeDirectory() / PORTABLE_DIR; | 92 | yuzu_path = GetExeDirectory() / PORTABLE_DIR; |
| 92 | 93 | #endif | |
| 93 | if (!IsDir(yuzu_path)) { | 94 | if (!IsDir(yuzu_path)) { |
| 94 | yuzu_path = GetAppDataRoamingDirectory() / YUZU_DIR; | 95 | yuzu_path = GetAppDataRoamingDirectory() / YUZU_DIR; |
| 95 | } | 96 | } |
| @@ -101,8 +102,9 @@ public: | |||
| 101 | yuzu_path_cache = yuzu_path / CACHE_DIR; | 102 | yuzu_path_cache = yuzu_path / CACHE_DIR; |
| 102 | yuzu_path_config = yuzu_path / CONFIG_DIR; | 103 | yuzu_path_config = yuzu_path / CONFIG_DIR; |
| 103 | #else | 104 | #else |
| 105 | #ifdef YUZU_ENABLE_PORTABLE | ||
| 104 | yuzu_path = GetCurrentDir() / PORTABLE_DIR; | 106 | yuzu_path = GetCurrentDir() / PORTABLE_DIR; |
| 105 | 107 | #endif | |
| 106 | if (Exists(yuzu_path) && IsDir(yuzu_path)) { | 108 | if (Exists(yuzu_path) && IsDir(yuzu_path)) { |
| 107 | yuzu_path_cache = yuzu_path / CACHE_DIR; | 109 | yuzu_path_cache = yuzu_path / CACHE_DIR; |
| 108 | yuzu_path_config = yuzu_path / CONFIG_DIR; | 110 | yuzu_path_config = yuzu_path / CONFIG_DIR; |