summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/disk_filesystem.cpp
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-03-23 17:09:09 +0100
committerSubv <subv2112@gmail.com>2018-03-23 20:27:07 +0100
commit4c06d55a81304d0e658adf441d8bdb90a32ba228 (patch)
tree5cd94183585e77ebf5dd78c19a336ccaf85d4f47 /src/core/file_sys/disk_filesystem.cpp
parentFS: Implemented IFileSystem::CreateDirectory. (diff)
downloadyuzu-4c06d55a81304d0e658adf441d8bdb90a32ba228.tar
yuzu-4c06d55a81304d0e658adf441d8bdb90a32ba228.tar.gz
yuzu-4c06d55a81304d0e658adf441d8bdb90a32ba228.tar.bz2
yuzu-4c06d55a81304d0e658adf441d8bdb90a32ba228.tar.lz
yuzu-4c06d55a81304d0e658adf441d8bdb90a32ba228.tar.xz
yuzu-4c06d55a81304d0e658adf441d8bdb90a32ba228.tar.zst
yuzu-4c06d55a81304d0e658adf441d8bdb90a32ba228.zip
Diffstat (limited to 'src/core/file_sys/disk_filesystem.cpp')
-rw-r--r--src/core/file_sys/disk_filesystem.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/core/file_sys/disk_filesystem.cpp b/src/core/file_sys/disk_filesystem.cpp
index 9383bf856..3a4b45721 100644
--- a/src/core/file_sys/disk_filesystem.cpp
+++ b/src/core/file_sys/disk_filesystem.cpp
@@ -11,13 +11,7 @@
namespace FileSys {
-std::string Disk_FileSystem::GetName() const {
- return "Disk";
-}
-
-ResultVal<std::unique_ptr<StorageBackend>> Disk_FileSystem::OpenFile(const std::string& path,
- Mode mode) const {
-
+static std::string ModeFlagsToString(Mode mode) {
std::string mode_str;
u32 mode_flags = static_cast<u32>(mode);
@@ -39,6 +33,19 @@ ResultVal<std::unique_ptr<StorageBackend>> Disk_FileSystem::OpenFile(const std::
mode_str += "b";
+ return mode_str;
+}
+
+std::string Disk_FileSystem::GetName() const {
+ return "Disk";
+}
+
+ResultVal<std::unique_ptr<StorageBackend>> Disk_FileSystem::OpenFile(const std::string& path,
+ Mode mode) const {
+
+ // Calculate the correct open mode for the file.
+ std::string mode_str = ModeFlagsToString(mode);
+
std::string full_path = base_directory + path;
auto file = std::make_shared<FileUtil::IOFile>(full_path, mode_str.c_str());