diff options
author | Chloe Marcec <dmarcecguzman@gmail.com> | 2021-09-06 11:35:55 +0200 |
---|---|---|
committer | Chloe Marcec <dmarcecguzman@gmail.com> | 2021-09-06 11:35:55 +0200 |
commit | 0b891c9245f45825978f762af3812c9ae794ed7f (patch) | |
tree | e629683dfe9fc532fd16b63ae65ab60cd86ede18 /src/core/hle/service | |
parent | Merge pull request #6900 from ameerj/attr-reorder (diff) | |
download | yuzu-0b891c9245f45825978f762af3812c9ae794ed7f.tar yuzu-0b891c9245f45825978f762af3812c9ae794ed7f.tar.gz yuzu-0b891c9245f45825978f762af3812c9ae794ed7f.tar.bz2 yuzu-0b891c9245f45825978f762af3812c9ae794ed7f.tar.lz yuzu-0b891c9245f45825978f762af3812c9ae794ed7f.tar.xz yuzu-0b891c9245f45825978f762af3812c9ae794ed7f.tar.zst yuzu-0b891c9245f45825978f762af3812c9ae794ed7f.zip |
Diffstat (limited to 'src/core/hle/service')
-rw-r--r-- | src/core/hle/service/filesystem/filesystem.cpp | 21 |
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 ResultCode VfsDirectoryServiceWrapper::CreateDirectory(const std::string& path_) const { std::string path(Common::FS::SanitizePath(path_)); - auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); - if (dir == nullptr || Common::FS::GetFilename(Common::FS::GetParentPath(path)).empty()) { - dir = backing; - } - auto new_dir = dir->CreateSubdirectory(Common::FS::GetFilename(path)); - if (new_dir == nullptr) { - // TODO(DarkLordZach): Find a better error code for this - return ResultUnknown; + const auto components = Common::FS::SplitPathComponents(path); + std::string relative_path = ""; + for (const auto& component : components) { + // Skip empty path components + if (component.empty()) { + continue; + } + relative_path = Common::FS::SanitizePath(relative_path + '/' + component); + auto new_dir = backing->CreateSubdirectory(relative_path); + if (new_dir == nullptr) { + // TODO(DarkLordZach): Find a better error code for this + return ResultUnknown; + } } return ResultSuccess; } |