summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-08-12 04:47:25 +0200
committerZach Hilman <zachhilman@gmail.com>2018-08-12 04:50:48 +0200
commit8f06a0f898fcade16f6ba9376cf4b72ff608f2ad (patch)
tree06e68c822c6e4c462e3d88a52cc2a12bcfb7da9a /src
parentcontrol_metadata: Remove unnecessary reference to base file (diff)
downloadyuzu-8f06a0f898fcade16f6ba9376cf4b72ff608f2ad.tar
yuzu-8f06a0f898fcade16f6ba9376cf4b72ff608f2ad.tar.gz
yuzu-8f06a0f898fcade16f6ba9376cf4b72ff608f2ad.tar.bz2
yuzu-8f06a0f898fcade16f6ba9376cf4b72ff608f2ad.tar.lz
yuzu-8f06a0f898fcade16f6ba9376cf4b72ff608f2ad.tar.xz
yuzu-8f06a0f898fcade16f6ba9376cf4b72ff608f2ad.tar.zst
yuzu-8f06a0f898fcade16f6ba9376cf4b72ff608f2ad.zip
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) {
VirtualFile RealVfsFilesystem::CreateFile(std::string_view path_, Mode perms) {
const auto path = FileUtil::SanitizePath(path_, FileUtil::DirectorySeparator::PlatformDefault);
- if (!FileUtil::Exists(path))
- return nullptr;
- if (!FileUtil::CreateFullPath(
- FileUtil::SanitizePath(path, FileUtil::DirectorySeparator::ForwardSlash)))
- return nullptr;
- if (!FileUtil::CreateEmptyFile(path))
+ const auto path_fwd = FileUtil::SanitizePath(path, FileUtil::DirectorySeparator::ForwardSlash);
+ if (!FileUtil::Exists(path) && !FileUtil::CreateFullPath(path_fwd) &&
+ !FileUtil::CreateEmptyFile(path))
return nullptr;
return OpenFile(path, perms);
}
@@ -145,12 +142,9 @@ 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))
- return nullptr;
- if (!FileUtil::CreateFullPath(
- FileUtil::SanitizePath(path, FileUtil::DirectorySeparator::ForwardSlash)))
- return nullptr;
- if (!FileUtil::CreateDir(path))
+ const auto path_fwd = FileUtil::SanitizePath(path, FileUtil::DirectorySeparator::ForwardSlash);
+ if (!FileUtil::Exists(path) && !FileUtil::CreateFullPath(path_fwd) &&
+ !FileUtil::CreateEmptyFile(path))
return nullptr;
// Cannot use make_shared as RealVfsDirectory constructor is private
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 @@
#pragma once
#include <string_view>
-
#include <boost/container/flat_map.hpp>
#include "common/file_util.h"
#include "core/file_sys/mode.h"