summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/file_sys/vfs_real.cpp18
-rw-r--r--src/core/file_sys/vfs_real.h1
2 files changed, 6 insertions, 13 deletions
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp
index 33ab35fcd..02cdb039a 100644
--- a/src/core/file_sys/vfs_real.cpp
+++ b/src/core/file_sys/vfs_real.cpp
@@ -83,12 +83,9 @@ VirtualFile RealVfsFilesystem::OpenFile(std::string_view path_, Mode perms) {
83 83
84VirtualFile RealVfsFilesystem::CreateFile(std::string_view path_, Mode perms) { 84VirtualFile 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)) 86 const auto path_fwd = FileUtil::SanitizePath(path, FileUtil::DirectorySeparator::ForwardSlash);
87 return nullptr; 87 if (!FileUtil::Exists(path) && !FileUtil::CreateFullPath(path_fwd) &&
88 if (!FileUtil::CreateFullPath( 88 !FileUtil::CreateEmptyFile(path))
89 FileUtil::SanitizePath(path, FileUtil::DirectorySeparator::ForwardSlash)))
90 return nullptr;
91 if (!FileUtil::CreateEmptyFile(path))
92 return nullptr; 89 return nullptr;
93 return OpenFile(path, perms); 90 return OpenFile(path, perms);
94} 91}
@@ -145,12 +142,9 @@ VirtualDir RealVfsFilesystem::OpenDirectory(std::string_view path_, Mode perms)
145 142
146VirtualDir RealVfsFilesystem::CreateDirectory(std::string_view path_, Mode perms) { 143VirtualDir RealVfsFilesystem::CreateDirectory(std::string_view path_, Mode perms) {
147 const auto path = FileUtil::SanitizePath(path_, FileUtil::DirectorySeparator::PlatformDefault); 144 const auto path = FileUtil::SanitizePath(path_, FileUtil::DirectorySeparator::PlatformDefault);
148 if (!FileUtil::Exists(path)) 145 const auto path_fwd = FileUtil::SanitizePath(path, FileUtil::DirectorySeparator::ForwardSlash);
149 return nullptr; 146 if (!FileUtil::Exists(path) && !FileUtil::CreateFullPath(path_fwd) &&
150 if (!FileUtil::CreateFullPath( 147 !FileUtil::CreateEmptyFile(path))
151 FileUtil::SanitizePath(path, FileUtil::DirectorySeparator::ForwardSlash)))
152 return nullptr;
153 if (!FileUtil::CreateDir(path))
154 return nullptr; 148 return nullptr;
155 // Cannot use make_shared as RealVfsDirectory constructor is private 149 // Cannot use make_shared as RealVfsDirectory constructor is private
156 return std::shared_ptr<RealVfsDirectory>(new RealVfsDirectory(*this, path, perms)); 150 return std::shared_ptr<RealVfsDirectory>(new RealVfsDirectory(*this, path, perms));
diff --git a/src/core/file_sys/vfs_real.h b/src/core/file_sys/vfs_real.h
index 8a1e79ef6..989803d43 100644
--- a/src/core/file_sys/vfs_real.h
+++ b/src/core/file_sys/vfs_real.h
@@ -5,7 +5,6 @@
5#pragma once 5#pragma once
6 6
7#include <string_view> 7#include <string_view>
8
9#include <boost/container/flat_map.hpp> 8#include <boost/container/flat_map.hpp>
10#include "common/file_util.h" 9#include "common/file_util.h"
11#include "core/file_sys/mode.h" 10#include "core/file_sys/mode.h"