summaryrefslogtreecommitdiff
path: root/src/common/file_util.cpp
diff options
context:
space:
mode:
authorGravatar Morph2020-12-11 20:21:21 -0500
committerGravatar Morph2020-12-11 20:21:21 -0500
commitac3ec5ed132a8d8b63c4e95205521addb90fdd0f (patch)
treeef746996baf604e05dd7a0b04659de722a280eba /src/common/file_util.cpp
parentMerge pull request #5181 from Morph1984/5174-review (diff)
downloadyuzu-ac3ec5ed132a8d8b63c4e95205521addb90fdd0f.tar.gz
yuzu-ac3ec5ed132a8d8b63c4e95205521addb90fdd0f.tar.xz
yuzu-ac3ec5ed132a8d8b63c4e95205521addb90fdd0f.zip
Revert "Merge pull request #5181 from Morph1984/5174-review"
This reverts commit cdb36aef9ec9d30bdef1953f9ed46776ae2f12af, reversing changes made to 5e9b77129f2cf8c039a8d98033cae4ac0f93f515.
Diffstat (limited to 'src/common/file_util.cpp')
-rw-r--r--src/common/file_util.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 8e061ff6c..a286b9341 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -136,10 +136,16 @@ bool CreateDirs(const fs::path& path) {
136bool CreateFullPath(const fs::path& path) { 136bool CreateFullPath(const fs::path& path) {
137 LOG_TRACE(Common_Filesystem, "path {}", path); 137 LOG_TRACE(Common_Filesystem, "path {}", path);
138 138
139 if (path.has_extension()) { 139 // Removes trailing slashes and turns any '\' into '/'
140 return CreateDirs(path.parent_path()); 140 const auto new_path = SanitizePath(path.string(), DirectorySeparator::ForwardSlash);
141
142 if (new_path.rfind('.') == std::string::npos) {
143 // The path is a directory
144 return CreateDirs(new_path);
141 } else { 145 } else {
142 return CreateDirs(path); 146 // The path is a file
147 // Creates directory preceding the last '/'
148 return CreateDirs(new_path.substr(0, new_path.rfind('/')));
143 } 149 }
144} 150}
145 151