From 1992dbc3cfd050b6fce4c8b7e461cb60263b14a5 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Fri, 11 Dec 2020 20:21:21 -0500 Subject: [PATCH] Revert "Merge pull request #5181 from Morph1984/5174-review" This reverts commit 1f3f6640f6d21375f436a0dd43f75aecfe36fa25, reversing changes made to 38152bb0f79838ed2aa9f030af643dda10b26862. --- src/common/file_util.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 8e061ff6c7..a286b93412 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -136,10 +136,16 @@ bool CreateDirs(const fs::path& path) { bool CreateFullPath(const fs::path& path) { LOG_TRACE(Common_Filesystem, "path {}", path); - if (path.has_extension()) { - return CreateDirs(path.parent_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); } else { - return CreateDirs(path); + // The path is a file + // Creates directory preceding the last '/' + return CreateDirs(new_path.substr(0, new_path.rfind('/'))); } }