summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/vfs_real.cpp
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-08-11 21:39:09 +0200
committerZach Hilman <zachhilman@gmail.com>2018-08-12 04:50:48 +0200
commit893447b6b0f5068f3cc2111b5f21c3cff68002e2 (patch)
treef2451fcb2478243621b6952ca5b006f22f957022 /src/core/file_sys/vfs_real.cpp
parentnca_metadata: Remove unnecessary reference to base file (diff)
downloadyuzu-893447b6b0f5068f3cc2111b5f21c3cff68002e2.tar
yuzu-893447b6b0f5068f3cc2111b5f21c3cff68002e2.tar.gz
yuzu-893447b6b0f5068f3cc2111b5f21c3cff68002e2.tar.bz2
yuzu-893447b6b0f5068f3cc2111b5f21c3cff68002e2.tar.lz
yuzu-893447b6b0f5068f3cc2111b5f21c3cff68002e2.tar.xz
yuzu-893447b6b0f5068f3cc2111b5f21c3cff68002e2.tar.zst
yuzu-893447b6b0f5068f3cc2111b5f21c3cff68002e2.zip
Diffstat (limited to 'src/core/file_sys/vfs_real.cpp')
-rw-r--r--src/core/file_sys/vfs_real.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp
index fa682153c..33ab35fcd 100644
--- a/src/core/file_sys/vfs_real.cpp
+++ b/src/core/file_sys/vfs_real.cpp
@@ -83,10 +83,12 @@ VirtualFile RealVfsFilesystem::OpenFile(std::string_view path_, Mode perms) {
VirtualFile RealVfsFilesystem::CreateFile(std::string_view path_, Mode perms) {
const auto path = FileUtil::SanitizePath(path_, FileUtil::DirectorySeparator::PlatformDefault);
- if (!FileUtil::Exists(path) &&
- !FileUtil::CreateFullPath(
- FileUtil::SanitizePath(path, FileUtil::DirectorySeparator::ForwardSlash)) &&
- !FileUtil::CreateEmptyFile(path))
+ if (!FileUtil::Exists(path))
+ return nullptr;
+ if (!FileUtil::CreateFullPath(
+ FileUtil::SanitizePath(path, FileUtil::DirectorySeparator::ForwardSlash)))
+ return nullptr;
+ if (!FileUtil::CreateEmptyFile(path))
return nullptr;
return OpenFile(path, perms);
}
@@ -143,7 +145,12 @@ VirtualDir RealVfsFilesystem::OpenDirectory(std::string_view path_, Mode perms)
VirtualDir RealVfsFilesystem::CreateDirectory(std::string_view path_, Mode perms) {
const auto path = FileUtil::SanitizePath(path_, FileUtil::DirectorySeparator::PlatformDefault);
- if (!FileUtil::Exists(path) && !FileUtil::CreateDir(path))
+ if (!FileUtil::Exists(path))
+ return nullptr;
+ if (!FileUtil::CreateFullPath(
+ FileUtil::SanitizePath(path, FileUtil::DirectorySeparator::ForwardSlash)))
+ return nullptr;
+ if (!FileUtil::CreateDir(path))
return nullptr;
// Cannot use make_shared as RealVfsDirectory constructor is private
return std::shared_ptr<RealVfsDirectory>(new RealVfsDirectory(*this, path, perms));