summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-08-10 02:50:50 +0200
committerZach Hilman <zachhilman@gmail.com>2018-08-12 04:50:48 +0200
commit9b0e3556edf9a77d8d782f56e064935e3e455242 (patch)
treeb014193046dcd6aa46fef907d766b443ae190636 /src
parentfilesystem: Add Open and Register functions for BISFactory (diff)
downloadyuzu-9b0e3556edf9a77d8d782f56e064935e3e455242.tar
yuzu-9b0e3556edf9a77d8d782f56e064935e3e455242.tar.gz
yuzu-9b0e3556edf9a77d8d782f56e064935e3e455242.tar.bz2
yuzu-9b0e3556edf9a77d8d782f56e064935e3e455242.tar.lz
yuzu-9b0e3556edf9a77d8d782f56e064935e3e455242.tar.xz
yuzu-9b0e3556edf9a77d8d782f56e064935e3e455242.tar.zst
yuzu-9b0e3556edf9a77d8d782f56e064935e3e455242.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/file_sys/vfs_real.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp
index 1b5919737..fa682153c 100644
--- a/src/core/file_sys/vfs_real.cpp
+++ b/src/core/file_sys/vfs_real.cpp
@@ -83,7 +83,10 @@ 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::CreateEmptyFile(path))
+ if (!FileUtil::Exists(path) &&
+ !FileUtil::CreateFullPath(
+ FileUtil::SanitizePath(path, FileUtil::DirectorySeparator::ForwardSlash)) &&
+ !FileUtil::CreateEmptyFile(path))
return nullptr;
return OpenFile(path, perms);
}
@@ -306,14 +309,14 @@ RealVfsDirectory::RealVfsDirectory(RealVfsFilesystem& base_, const std::string&
std::shared_ptr<VfsFile> RealVfsDirectory::GetFileRelative(std::string_view path) const {
const auto full_path = FileUtil::SanitizePath(this->path + DIR_SEP + std::string(path));
- if (!FileUtil::Exists(full_path))
+ if (!FileUtil::Exists(full_path) || FileUtil::IsDirectory(full_path))
return nullptr;
return base.OpenFile(full_path, perms);
}
std::shared_ptr<VfsDirectory> RealVfsDirectory::GetDirectoryRelative(std::string_view path) const {
const auto full_path = FileUtil::SanitizePath(this->path + DIR_SEP + std::string(path));
- if (!FileUtil::Exists(full_path))
+ if (!FileUtil::Exists(full_path) || !FileUtil::IsDirectory(full_path))
return nullptr;
return base.OpenDirectory(full_path, perms);
}