summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Chloe Marcec2021-09-06 19:35:55 +1000
committerGravatar Chloe Marcec2021-09-06 19:35:55 +1000
commit0b891c9245f45825978f762af3812c9ae794ed7f (patch)
treee629683dfe9fc532fd16b63ae65ab60cd86ede18 /src
parentMerge pull request #6900 from ameerj/attr-reorder (diff)
downloadyuzu-0b891c9245f45825978f762af3812c9ae794ed7f.tar.gz
yuzu-0b891c9245f45825978f762af3812c9ae794ed7f.tar.xz
yuzu-0b891c9245f45825978f762af3812c9ae794ed7f.zip
FS: Recursively create directories for CreateDirectory
Originally we only created the parent directory, this caused issues for creating directories which also contained subdirectories, eg `/Folder1/Folder2` This allows the ultimate mod manager homebrew to at least boot
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index 4a9b13e45..14a491dd5 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -97,14 +97,19 @@ ResultCode VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) cons
97 97
98ResultCode VfsDirectoryServiceWrapper::CreateDirectory(const std::string& path_) const { 98ResultCode VfsDirectoryServiceWrapper::CreateDirectory(const std::string& path_) const {
99 std::string path(Common::FS::SanitizePath(path_)); 99 std::string path(Common::FS::SanitizePath(path_));
100 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); 100 const auto components = Common::FS::SplitPathComponents(path);
101 if (dir == nullptr || Common::FS::GetFilename(Common::FS::GetParentPath(path)).empty()) { 101 std::string relative_path = "";
102 dir = backing; 102 for (const auto& component : components) {
103 } 103 // Skip empty path components
104 auto new_dir = dir->CreateSubdirectory(Common::FS::GetFilename(path)); 104 if (component.empty()) {
105 if (new_dir == nullptr) { 105 continue;
106 // TODO(DarkLordZach): Find a better error code for this 106 }
107 return ResultUnknown; 107 relative_path = Common::FS::SanitizePath(relative_path + '/' + component);
108 auto new_dir = backing->CreateSubdirectory(relative_path);
109 if (new_dir == nullptr) {
110 // TODO(DarkLordZach): Find a better error code for this
111 return ResultUnknown;
112 }
108 } 113 }
109 return ResultSuccess; 114 return ResultSuccess;
110} 115}