diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/file_sys/vfs_real.cpp | 9 |
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) { | |||
| 83 | 83 | ||
| 84 | VirtualFile RealVfsFilesystem::CreateFile(std::string_view path_, Mode perms) { | 84 | VirtualFile RealVfsFilesystem::CreateFile(std::string_view path_, Mode perms) { |
| 85 | const auto path = FileUtil::SanitizePath(path_, FileUtil::DirectorySeparator::PlatformDefault); | 85 | const auto path = FileUtil::SanitizePath(path_, FileUtil::DirectorySeparator::PlatformDefault); |
| 86 | if (!FileUtil::Exists(path) && !FileUtil::CreateEmptyFile(path)) | 86 | if (!FileUtil::Exists(path) && |
| 87 | !FileUtil::CreateFullPath( | ||
| 88 | FileUtil::SanitizePath(path, FileUtil::DirectorySeparator::ForwardSlash)) && | ||
| 89 | !FileUtil::CreateEmptyFile(path)) | ||
| 87 | return nullptr; | 90 | return nullptr; |
| 88 | return OpenFile(path, perms); | 91 | return OpenFile(path, perms); |
| 89 | } | 92 | } |
| @@ -306,14 +309,14 @@ RealVfsDirectory::RealVfsDirectory(RealVfsFilesystem& base_, const std::string& | |||
| 306 | 309 | ||
| 307 | std::shared_ptr<VfsFile> RealVfsDirectory::GetFileRelative(std::string_view path) const { | 310 | std::shared_ptr<VfsFile> RealVfsDirectory::GetFileRelative(std::string_view path) const { |
| 308 | const auto full_path = FileUtil::SanitizePath(this->path + DIR_SEP + std::string(path)); | 311 | const auto full_path = FileUtil::SanitizePath(this->path + DIR_SEP + std::string(path)); |
| 309 | if (!FileUtil::Exists(full_path)) | 312 | if (!FileUtil::Exists(full_path) || FileUtil::IsDirectory(full_path)) |
| 310 | return nullptr; | 313 | return nullptr; |
| 311 | return base.OpenFile(full_path, perms); | 314 | return base.OpenFile(full_path, perms); |
| 312 | } | 315 | } |
| 313 | 316 | ||
| 314 | std::shared_ptr<VfsDirectory> RealVfsDirectory::GetDirectoryRelative(std::string_view path) const { | 317 | std::shared_ptr<VfsDirectory> RealVfsDirectory::GetDirectoryRelative(std::string_view path) const { |
| 315 | const auto full_path = FileUtil::SanitizePath(this->path + DIR_SEP + std::string(path)); | 318 | const auto full_path = FileUtil::SanitizePath(this->path + DIR_SEP + std::string(path)); |
| 316 | if (!FileUtil::Exists(full_path)) | 319 | if (!FileUtil::Exists(full_path) || !FileUtil::IsDirectory(full_path)) |
| 317 | return nullptr; | 320 | return nullptr; |
| 318 | return base.OpenDirectory(full_path, perms); | 321 | return base.OpenDirectory(full_path, perms); |
| 319 | } | 322 | } |