diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2023-02-22 21:03:23 +0100 |
|---|---|---|
| committer | Admiral H. Curtiss <pikachu025@gmail.com> | 2023-02-24 20:32:19 +0100 |
| commit | 884917a6d534cdce4fe7b2f39e1188e591d64b0f (patch) | |
| tree | 688ecb1324f8afda69abb3fc58d181cd08ecd993 /Source/Core/Common | |
| parent | e479f9241829130d9a23b12eea2b1142b6e2f282 (diff) | |
Common/FileUtil: Use non-throwing overload of is_directory() in CreateDir() and CreateFullPath().
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/FileUtil.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 454277f55a..656e74134b 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -201,7 +201,8 @@ bool CreateDir(const std::string& path) auto native_path = StringToPath(path); bool success = fs::create_directory(native_path, error); // If the path was not created, check if it was a pre-existing directory - if (!success && fs::is_directory(native_path)) + std::error_code error_ignored; + if (!success && fs::is_directory(native_path, error_ignored)) success = true; if (!success) ERROR_LOG_FMT(COMMON, "{}: failed on {}: {}", __func__, path, error.message()); @@ -232,7 +233,8 @@ bool CreateFullPath(std::string_view fullPath) auto native_path = StringToPath(fullPath).parent_path(); bool success = fs::create_directories(native_path, error); // If the path was not created, check if it was a pre-existing directory - if (!success && fs::is_directory(native_path)) + std::error_code error_ignored; + if (!success && fs::is_directory(native_path, error_ignored)) success = true; if (!success) ERROR_LOG_FMT(COMMON, "{}: failed on {}: {}", __func__, fullPath, error.message()); |
