diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-08-12 21:55:44 +0200 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-08-12 21:55:44 +0200 |
commit | 35e4a47be0c4ef25f860d51851d2c02c02dff53d (patch) | |
tree | e1ef42bdd5e4e2bdfc7bd3a0abf0e35cbc912dbd /src/core/file_sys/vfs_real.cpp | |
parent | registration: Add support for force overwrite of installed (diff) | |
download | yuzu-35e4a47be0c4ef25f860d51851d2c02c02dff53d.tar yuzu-35e4a47be0c4ef25f860d51851d2c02c02dff53d.tar.gz yuzu-35e4a47be0c4ef25f860d51851d2c02c02dff53d.tar.bz2 yuzu-35e4a47be0c4ef25f860d51851d2c02c02dff53d.tar.lz yuzu-35e4a47be0c4ef25f860d51851d2c02c02dff53d.tar.xz yuzu-35e4a47be0c4ef25f860d51851d2c02c02dff53d.tar.zst yuzu-35e4a47be0c4ef25f860d51851d2c02c02dff53d.zip |
Diffstat (limited to 'src/core/file_sys/vfs_real.cpp')
-rw-r--r-- | src/core/file_sys/vfs_real.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp index 02cdb039a..0afe515f0 100644 --- a/src/core/file_sys/vfs_real.cpp +++ b/src/core/file_sys/vfs_real.cpp @@ -84,9 +84,11 @@ 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); const auto path_fwd = FileUtil::SanitizePath(path, FileUtil::DirectorySeparator::ForwardSlash); - if (!FileUtil::Exists(path) && !FileUtil::CreateFullPath(path_fwd) && - !FileUtil::CreateEmptyFile(path)) - return nullptr; + if (!FileUtil::Exists(path)) { + FileUtil::CreateFullPath(path_fwd); + if (!FileUtil::CreateEmptyFile(path)) + return nullptr; + } return OpenFile(path, perms); } @@ -143,9 +145,11 @@ 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); const auto path_fwd = FileUtil::SanitizePath(path, FileUtil::DirectorySeparator::ForwardSlash); - if (!FileUtil::Exists(path) && !FileUtil::CreateFullPath(path_fwd) && - !FileUtil::CreateEmptyFile(path)) - return nullptr; + if (!FileUtil::Exists(path)) { + FileUtil::CreateFullPath(path_fwd); + 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)); } |