summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Subv2018-03-23 11:09:09 -0500
committerGravatar Subv2018-03-23 14:27:07 -0500
commit4c06d55a81304d0e658adf441d8bdb90a32ba228 (patch)
tree5cd94183585e77ebf5dd78c19a336ccaf85d4f47 /src/core
parentFS: Implemented IFileSystem::CreateDirectory. (diff)
downloadyuzu-4c06d55a81304d0e658adf441d8bdb90a32ba228.tar.gz
yuzu-4c06d55a81304d0e658adf441d8bdb90a32ba228.tar.xz
yuzu-4c06d55a81304d0e658adf441d8bdb90a32ba228.zip
FS: Move the file open mode calculation to a separate function.
Diffstat (limited to 'src/core')
-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 @@
11 11
12namespace FileSys { 12namespace FileSys {
13 13
14std::string Disk_FileSystem::GetName() const { 14static std::string ModeFlagsToString(Mode mode) {
15 return "Disk";
16}
17
18ResultVal<std::unique_ptr<StorageBackend>> Disk_FileSystem::OpenFile(const std::string& path,
19 Mode mode) const {
20
21 std::string mode_str; 15 std::string mode_str;
22 u32 mode_flags = static_cast<u32>(mode); 16 u32 mode_flags = static_cast<u32>(mode);
23 17
@@ -39,6 +33,19 @@ ResultVal<std::unique_ptr<StorageBackend>> Disk_FileSystem::OpenFile(const std::
39 33
40 mode_str += "b"; 34 mode_str += "b";
41 35
36 return mode_str;
37}
38
39std::string Disk_FileSystem::GetName() const {
40 return "Disk";
41}
42
43ResultVal<std::unique_ptr<StorageBackend>> Disk_FileSystem::OpenFile(const std::string& path,
44 Mode mode) const {
45
46 // Calculate the correct open mode for the file.
47 std::string mode_str = ModeFlagsToString(mode);
48
42 std::string full_path = base_directory + path; 49 std::string full_path = base_directory + path;
43 auto file = std::make_shared<FileUtil::IOFile>(full_path, mode_str.c_str()); 50 auto file = std::make_shared<FileUtil::IOFile>(full_path, mode_str.c_str());
44 51