diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2023-02-15 02:13:47 +0100 |
|---|---|---|
| committer | Admiral H. Curtiss <pikachu025@gmail.com> | 2023-02-15 02:21:50 +0100 |
| commit | 0758e00cfecb300ec71982c0c4b3118384d0a358 (patch) | |
| tree | 9b2c213fefa30715df36ab5a9cff4686eccf2428 /Source | |
| parent | 661b74f4a3d9fee4acf80b4e399a6c45e1f21fa3 (diff) | |
Common/FileUtil: Revert behavior of CreateFullPath().
This was accidentally changed in 7e6436db347c3cc479d768180de158a0f9c88226.
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Common/FileUtil.cpp | 5 | ||||
| -rw-r--r-- | Source/Core/Common/FileUtil.h | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 3944005d6c..f1e0517644 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -209,13 +209,12 @@ bool CreateDir(const std::string& path) return success; } -// Creates the full path of fullPath returns true on success -bool CreateFullPath(const std::string& fullPath) +bool CreateFullPath(std::string_view fullPath) { DEBUG_LOG_FMT(COMMON, "{}: path {}", __func__, fullPath); std::error_code error; - auto native_path = StringToPath(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)) diff --git a/Source/Core/Common/FileUtil.h b/Source/Core/Common/FileUtil.h index 37bced5a68..4fd2d950f5 100644 --- a/Source/Core/Common/FileUtil.h +++ b/Source/Core/Common/FileUtil.h @@ -143,8 +143,10 @@ u64 GetSize(FILE* f); // Returns true if successful, or path already exists. bool CreateDir(const std::string& filename); -// Creates the full path of fullPath returns true on success -bool CreateFullPath(const std::string& fullPath); +// Creates the full path to the file given in fullPath. +// That is, for path '/a/b/c.bin', creates folders '/a' and '/a/b'. +// Returns true if creation is successful or if the path already exists. +bool CreateFullPath(std::string_view fullPath); enum class IfAbsentBehavior { |
