diff options
author | Morph <39850852+Morph1984@users.noreply.github.com> | 2021-09-12 18:02:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-12 18:02:39 +0200 |
commit | f0f416e85cd23c97c51f33413b4f8eed57622502 (patch) | |
tree | 8fd6687dc1f364d3bd701b0b3e92c6751b903664 /src/core | |
parent | Merge pull request #6997 from ameerj/stop-emulation-confirmation (diff) | |
parent | Addressed issues (diff) | |
download | yuzu-f0f416e85cd23c97c51f33413b4f8eed57622502.tar yuzu-f0f416e85cd23c97c51f33413b4f8eed57622502.tar.gz yuzu-f0f416e85cd23c97c51f33413b4f8eed57622502.tar.bz2 yuzu-f0f416e85cd23c97c51f33413b4f8eed57622502.tar.lz yuzu-f0f416e85cd23c97c51f33413b4f8eed57622502.tar.xz yuzu-f0f416e85cd23c97c51f33413b4f8eed57622502.tar.zst yuzu-f0f416e85cd23c97c51f33413b4f8eed57622502.zip |
Diffstat (limited to 'src/core')
-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..db17d61e4 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; } |