diff options
| author | 2020-12-10 15:52:11 -0800 | |
|---|---|---|
| committer | 2020-12-10 15:52:11 -0800 | |
| commit | cdb36aef9ec9d30bdef1953f9ed46776ae2f12af (patch) | |
| tree | f5d1632aaa7fea63a9f03ab7a940e11ee7bf2e8a /src/common/file_util.cpp | |
| parent | Merge pull request #5184 from lat9nq/travis-linux-ccache-fix (diff) | |
| parent | common/file_util: Simplify the behavior of CreateFullPath (diff) | |
| download | yuzu-cdb36aef9ec9d30bdef1953f9ed46776ae2f12af.tar.gz yuzu-cdb36aef9ec9d30bdef1953f9ed46776ae2f12af.tar.xz yuzu-cdb36aef9ec9d30bdef1953f9ed46776ae2f12af.zip | |
Merge pull request #5181 from Morph1984/5174-review
common/file_util: Address review comments of #5174
Diffstat (limited to '')
| -rw-r--r-- | src/common/file_util.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index a286b9341..8e061ff6c 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp | |||
| @@ -136,16 +136,10 @@ bool CreateDirs(const fs::path& path) { | |||
| 136 | bool CreateFullPath(const fs::path& path) { | 136 | bool CreateFullPath(const fs::path& path) { |
| 137 | LOG_TRACE(Common_Filesystem, "path {}", path); | 137 | LOG_TRACE(Common_Filesystem, "path {}", path); |
| 138 | 138 | ||
| 139 | // Removes trailing slashes and turns any '\' into '/' | 139 | if (path.has_extension()) { |
| 140 | const auto new_path = SanitizePath(path.string(), DirectorySeparator::ForwardSlash); | 140 | return CreateDirs(path.parent_path()); |
| 141 | |||
| 142 | if (new_path.rfind('.') == std::string::npos) { | ||
| 143 | // The path is a directory | ||
| 144 | return CreateDirs(new_path); | ||
| 145 | } else { | 141 | } else { |
| 146 | // The path is a file | 142 | return CreateDirs(path); |
| 147 | // Creates directory preceding the last '/' | ||
| 148 | return CreateDirs(new_path.substr(0, new_path.rfind('/'))); | ||
| 149 | } | 143 | } |
| 150 | } | 144 | } |
| 151 | 145 | ||