diff options
author | bunnei <bunneidev@gmail.com> | 2020-12-11 00:52:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-11 00:52:11 +0100 |
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 yuzu-cdb36aef9ec9d30bdef1953f9ed46776ae2f12af.tar.gz yuzu-cdb36aef9ec9d30bdef1953f9ed46776ae2f12af.tar.bz2 yuzu-cdb36aef9ec9d30bdef1953f9ed46776ae2f12af.tar.lz yuzu-cdb36aef9ec9d30bdef1953f9ed46776ae2f12af.tar.xz yuzu-cdb36aef9ec9d30bdef1953f9ed46776ae2f12af.tar.zst yuzu-cdb36aef9ec9d30bdef1953f9ed46776ae2f12af.zip |
Diffstat (limited to 'src/common/file_util.cpp')
-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) { bool CreateFullPath(const fs::path& path) { LOG_TRACE(Common_Filesystem, "path {}", path); - // Removes trailing slashes and turns any '\' into '/' - const auto new_path = SanitizePath(path.string(), DirectorySeparator::ForwardSlash); - - if (new_path.rfind('.') == std::string::npos) { - // The path is a directory - return CreateDirs(new_path); + if (path.has_extension()) { + return CreateDirs(path.parent_path()); } else { - // The path is a file - // Creates directory preceding the last '/' - return CreateDirs(new_path.substr(0, new_path.rfind('/'))); + return CreateDirs(path); } } |