Browse Source
Merge pull request #11499 from Squall-Leonhart/bitlockerfix
add std::error_code for std::filesystem exceptions
pull/15/merge
liamwhite
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
9 additions and
6 deletions
-
src/common/fs/fs.cpp
|
|
|
@ -528,38 +528,41 @@ void IterateDirEntriesRecursively(const std::filesystem::path& path, |
|
|
|
// Generic Filesystem Operations
|
|
|
|
|
|
|
|
bool Exists(const fs::path& path) { |
|
|
|
std::error_code ec; |
|
|
|
#ifdef ANDROID
|
|
|
|
if (Android::IsContentUri(path)) { |
|
|
|
return Android::Exists(path); |
|
|
|
} else { |
|
|
|
return fs::exists(path); |
|
|
|
return fs::exists(path, ec); |
|
|
|
} |
|
|
|
#else
|
|
|
|
return fs::exists(path); |
|
|
|
return fs::exists(path, ec); |
|
|
|
#endif
|
|
|
|
} |
|
|
|
|
|
|
|
bool IsFile(const fs::path& path) { |
|
|
|
std::error_code ec; |
|
|
|
#ifdef ANDROID
|
|
|
|
if (Android::IsContentUri(path)) { |
|
|
|
return !Android::IsDirectory(path); |
|
|
|
} else { |
|
|
|
return fs::is_regular_file(path); |
|
|
|
return fs::is_regular_file(path, ec); |
|
|
|
} |
|
|
|
#else
|
|
|
|
return fs::is_regular_file(path); |
|
|
|
return fs::is_regular_file(path, ec); |
|
|
|
#endif
|
|
|
|
} |
|
|
|
|
|
|
|
bool IsDir(const fs::path& path) { |
|
|
|
std::error_code ec; |
|
|
|
#ifdef ANDROID
|
|
|
|
if (Android::IsContentUri(path)) { |
|
|
|
return Android::IsDirectory(path); |
|
|
|
} else { |
|
|
|
return fs::is_directory(path); |
|
|
|
return fs::is_directory(path, ec); |
|
|
|
} |
|
|
|
#else
|
|
|
|
return fs::is_directory(path); |
|
|
|
return fs::is_directory(path, ec); |
|
|
|
#endif
|
|
|
|
} |
|
|
|
|
|
|
|
|