summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2020-07-18 00:59:26 -0400
committerGravatar GitHub2020-07-18 00:59:26 -0400
commitc700079e0815055df43bf0a337e9c562fb76d205 (patch)
tree03065d2091f44a6b55838d9b10e9d1904f64c941
parentMerge pull request #4273 from ogniK5377/async-shaders-prod (diff)
parentAdd comment to clarify the nullptr check (diff)
downloadyuzu-c700079e0815055df43bf0a337e9c562fb76d205.tar.gz
yuzu-c700079e0815055df43bf0a337e9c562fb76d205.tar.xz
yuzu-c700079e0815055df43bf0a337e9c562fb76d205.zip
Merge pull request #4345 from Morph1984/fix-createfile
filesystem: Create subdirectories prior to creating a file
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index cadc03805..c66124998 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -55,6 +55,10 @@ std::string VfsDirectoryServiceWrapper::GetName() const {
55ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 size) const { 55ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 size) const {
56 std::string path(FileUtil::SanitizePath(path_)); 56 std::string path(FileUtil::SanitizePath(path_));
57 auto dir = GetDirectoryRelativeWrapped(backing, FileUtil::GetParentPath(path)); 57 auto dir = GetDirectoryRelativeWrapped(backing, FileUtil::GetParentPath(path));
58 // dir can be nullptr if path contains subdirectories, create those prior to creating the file.
59 if (dir == nullptr) {
60 dir = backing->CreateSubdirectory(FileUtil::GetParentPath(path));
61 }
58 auto file = dir->CreateFile(FileUtil::GetFilename(path)); 62 auto file = dir->CreateFile(FileUtil::GetFilename(path));
59 if (file == nullptr) { 63 if (file == nullptr) {
60 // TODO(DarkLordZach): Find a better error code for this 64 // TODO(DarkLordZach): Find a better error code for this