summaryrefslogtreecommitdiff
path: root/src/core/hle/service/filesystem
diff options
context:
space:
mode:
authorGravatar Morph2022-06-28 16:59:33 -0700
committerGravatar GitHub2022-06-28 16:59:33 -0700
commit01bc0c84f021ad389309aeb23bdb063070aeb2fe (patch)
tree720dc203d1eeb85e47c6f9b0d57cd00ec8a69038 /src/core/hle/service/filesystem
parentMerge pull request #8504 from comex/mesosphere-current-process (diff)
parentvideo_core: Replace VKUpdateDescriptorQueue with UpdateDescriptorQueue (diff)
downloadyuzu-01bc0c84f021ad389309aeb23bdb063070aeb2fe.tar.gz
yuzu-01bc0c84f021ad389309aeb23bdb063070aeb2fe.tar.xz
yuzu-01bc0c84f021ad389309aeb23bdb063070aeb2fe.zip
Merge pull request #8512 from german77/nnResult
Replace multiple names with a better name
Diffstat (limited to 'src/core/hle/service/filesystem')
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp29
-rw-r--r--src/core/hle/service/filesystem/filesystem.h26
2 files changed, 27 insertions, 28 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index f8e7519ca..11c604a0f 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -49,7 +49,7 @@ std::string VfsDirectoryServiceWrapper::GetName() const {
49 return backing->GetName(); 49 return backing->GetName();
50} 50}
51 51
52ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 size) const { 52Result VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 size) const {
53 std::string path(Common::FS::SanitizePath(path_)); 53 std::string path(Common::FS::SanitizePath(path_));
54 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); 54 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path));
55 if (dir == nullptr) { 55 if (dir == nullptr) {
@@ -73,7 +73,7 @@ ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64
73 return ResultSuccess; 73 return ResultSuccess;
74} 74}
75 75
76ResultCode VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) const { 76Result VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) const {
77 std::string path(Common::FS::SanitizePath(path_)); 77 std::string path(Common::FS::SanitizePath(path_));
78 if (path.empty()) { 78 if (path.empty()) {
79 // TODO(DarkLordZach): Why do games call this and what should it do? Works as is but... 79 // TODO(DarkLordZach): Why do games call this and what should it do? Works as is but...
@@ -92,7 +92,7 @@ ResultCode VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) cons
92 return ResultSuccess; 92 return ResultSuccess;
93} 93}
94 94
95ResultCode VfsDirectoryServiceWrapper::CreateDirectory(const std::string& path_) const { 95Result VfsDirectoryServiceWrapper::CreateDirectory(const std::string& path_) const {
96 std::string path(Common::FS::SanitizePath(path_)); 96 std::string path(Common::FS::SanitizePath(path_));
97 97
98 // NOTE: This is inaccurate behavior. CreateDirectory is not recursive. 98 // NOTE: This is inaccurate behavior. CreateDirectory is not recursive.
@@ -116,7 +116,7 @@ ResultCode VfsDirectoryServiceWrapper::CreateDirectory(const std::string& path_)
116 return ResultSuccess; 116 return ResultSuccess;
117} 117}
118 118
119ResultCode VfsDirectoryServiceWrapper::DeleteDirectory(const std::string& path_) const { 119Result VfsDirectoryServiceWrapper::DeleteDirectory(const std::string& path_) const {
120 std::string path(Common::FS::SanitizePath(path_)); 120 std::string path(Common::FS::SanitizePath(path_));
121 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); 121 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path));
122 if (!dir->DeleteSubdirectory(Common::FS::GetFilename(path))) { 122 if (!dir->DeleteSubdirectory(Common::FS::GetFilename(path))) {
@@ -126,7 +126,7 @@ ResultCode VfsDirectoryServiceWrapper::DeleteDirectory(const std::string& path_)
126 return ResultSuccess; 126 return ResultSuccess;
127} 127}
128 128
129ResultCode VfsDirectoryServiceWrapper::DeleteDirectoryRecursively(const std::string& path_) const { 129Result VfsDirectoryServiceWrapper::DeleteDirectoryRecursively(const std::string& path_) const {
130 std::string path(Common::FS::SanitizePath(path_)); 130 std::string path(Common::FS::SanitizePath(path_));
131 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); 131 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path));
132 if (!dir->DeleteSubdirectoryRecursive(Common::FS::GetFilename(path))) { 132 if (!dir->DeleteSubdirectoryRecursive(Common::FS::GetFilename(path))) {
@@ -136,7 +136,7 @@ ResultCode VfsDirectoryServiceWrapper::DeleteDirectoryRecursively(const std::str
136 return ResultSuccess; 136 return ResultSuccess;
137} 137}
138 138
139ResultCode VfsDirectoryServiceWrapper::CleanDirectoryRecursively(const std::string& path) const { 139Result VfsDirectoryServiceWrapper::CleanDirectoryRecursively(const std::string& path) const {
140 const std::string sanitized_path(Common::FS::SanitizePath(path)); 140 const std::string sanitized_path(Common::FS::SanitizePath(path));
141 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(sanitized_path)); 141 auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(sanitized_path));
142 142
@@ -148,8 +148,8 @@ ResultCode VfsDirectoryServiceWrapper::CleanDirectoryRecursively(const std::stri
148 return ResultSuccess; 148 return ResultSuccess;
149} 149}
150 150
151ResultCode VfsDirectoryServiceWrapper::RenameFile(const std::string& src_path_, 151Result VfsDirectoryServiceWrapper::RenameFile(const std::string& src_path_,
152 const std::string& dest_path_) const { 152 const std::string& dest_path_) const {
153 std::string src_path(Common::FS::SanitizePath(src_path_)); 153 std::string src_path(Common::FS::SanitizePath(src_path_));
154 std::string dest_path(Common::FS::SanitizePath(dest_path_)); 154 std::string dest_path(Common::FS::SanitizePath(dest_path_));
155 auto src = backing->GetFileRelative(src_path); 155 auto src = backing->GetFileRelative(src_path);
@@ -183,8 +183,8 @@ ResultCode VfsDirectoryServiceWrapper::RenameFile(const std::string& src_path_,
183 return ResultSuccess; 183 return ResultSuccess;
184} 184}
185 185
186ResultCode VfsDirectoryServiceWrapper::RenameDirectory(const std::string& src_path_, 186Result VfsDirectoryServiceWrapper::RenameDirectory(const std::string& src_path_,
187 const std::string& dest_path_) const { 187 const std::string& dest_path_) const {
188 std::string src_path(Common::FS::SanitizePath(src_path_)); 188 std::string src_path(Common::FS::SanitizePath(src_path_));
189 std::string dest_path(Common::FS::SanitizePath(dest_path_)); 189 std::string dest_path(Common::FS::SanitizePath(dest_path_));
190 auto src = GetDirectoryRelativeWrapped(backing, src_path); 190 auto src = GetDirectoryRelativeWrapped(backing, src_path);
@@ -273,28 +273,27 @@ FileSystemController::FileSystemController(Core::System& system_) : system{syste
273 273
274FileSystemController::~FileSystemController() = default; 274FileSystemController::~FileSystemController() = default;
275 275
276ResultCode FileSystemController::RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory) { 276Result FileSystemController::RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory) {
277 romfs_factory = std::move(factory); 277 romfs_factory = std::move(factory);
278 LOG_DEBUG(Service_FS, "Registered RomFS"); 278 LOG_DEBUG(Service_FS, "Registered RomFS");
279 return ResultSuccess; 279 return ResultSuccess;
280} 280}
281 281
282ResultCode FileSystemController::RegisterSaveData( 282Result FileSystemController::RegisterSaveData(std::unique_ptr<FileSys::SaveDataFactory>&& factory) {
283 std::unique_ptr<FileSys::SaveDataFactory>&& factory) {
284 ASSERT_MSG(save_data_factory == nullptr, "Tried to register a second save data"); 283 ASSERT_MSG(save_data_factory == nullptr, "Tried to register a second save data");
285 save_data_factory = std::move(factory); 284 save_data_factory = std::move(factory);
286 LOG_DEBUG(Service_FS, "Registered save data"); 285 LOG_DEBUG(Service_FS, "Registered save data");
287 return ResultSuccess; 286 return ResultSuccess;
288} 287}
289 288
290ResultCode FileSystemController::RegisterSDMC(std::unique_ptr<FileSys::SDMCFactory>&& factory) { 289Result FileSystemController::RegisterSDMC(std::unique_ptr<FileSys::SDMCFactory>&& factory) {
291 ASSERT_MSG(sdmc_factory == nullptr, "Tried to register a second SDMC"); 290 ASSERT_MSG(sdmc_factory == nullptr, "Tried to register a second SDMC");
292 sdmc_factory = std::move(factory); 291 sdmc_factory = std::move(factory);
293 LOG_DEBUG(Service_FS, "Registered SDMC"); 292 LOG_DEBUG(Service_FS, "Registered SDMC");
294 return ResultSuccess; 293 return ResultSuccess;
295} 294}
296 295
297ResultCode FileSystemController::RegisterBIS(std::unique_ptr<FileSys::BISFactory>&& factory) { 296Result FileSystemController::RegisterBIS(std::unique_ptr<FileSys::BISFactory>&& factory) {
298 ASSERT_MSG(bis_factory == nullptr, "Tried to register a second BIS"); 297 ASSERT_MSG(bis_factory == nullptr, "Tried to register a second BIS");
299 bis_factory = std::move(factory); 298 bis_factory = std::move(factory);
300 LOG_DEBUG(Service_FS, "Registered BIS"); 299 LOG_DEBUG(Service_FS, "Registered BIS");
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h
index 8dd2652fe..5b27de9fa 100644
--- a/src/core/hle/service/filesystem/filesystem.h
+++ b/src/core/hle/service/filesystem/filesystem.h
@@ -58,10 +58,10 @@ public:
58 explicit FileSystemController(Core::System& system_); 58 explicit FileSystemController(Core::System& system_);
59 ~FileSystemController(); 59 ~FileSystemController();
60 60
61 ResultCode RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory); 61 Result RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory);
62 ResultCode RegisterSaveData(std::unique_ptr<FileSys::SaveDataFactory>&& factory); 62 Result RegisterSaveData(std::unique_ptr<FileSys::SaveDataFactory>&& factory);
63 ResultCode RegisterSDMC(std::unique_ptr<FileSys::SDMCFactory>&& factory); 63 Result RegisterSDMC(std::unique_ptr<FileSys::SDMCFactory>&& factory);
64 ResultCode RegisterBIS(std::unique_ptr<FileSys::BISFactory>&& factory); 64 Result RegisterBIS(std::unique_ptr<FileSys::BISFactory>&& factory);
65 65
66 void SetPackedUpdate(FileSys::VirtualFile update_raw); 66 void SetPackedUpdate(FileSys::VirtualFile update_raw);
67 ResultVal<FileSys::VirtualFile> OpenRomFSCurrentProcess() const; 67 ResultVal<FileSys::VirtualFile> OpenRomFSCurrentProcess() const;
@@ -141,7 +141,7 @@ private:
141 141
142void InstallInterfaces(Core::System& system); 142void InstallInterfaces(Core::System& system);
143 143
144// A class that wraps a VfsDirectory with methods that return ResultVal and ResultCode instead of 144// A class that wraps a VfsDirectory with methods that return ResultVal and Result instead of
145// pointers and booleans. This makes using a VfsDirectory with switch services much easier and 145// pointers and booleans. This makes using a VfsDirectory with switch services much easier and
146// avoids repetitive code. 146// avoids repetitive code.
147class VfsDirectoryServiceWrapper { 147class VfsDirectoryServiceWrapper {
@@ -160,35 +160,35 @@ public:
160 * @param size The size of the new file, filled with zeroes 160 * @param size The size of the new file, filled with zeroes
161 * @return Result of the operation 161 * @return Result of the operation
162 */ 162 */
163 ResultCode CreateFile(const std::string& path, u64 size) const; 163 Result CreateFile(const std::string& path, u64 size) const;
164 164
165 /** 165 /**
166 * Delete a file specified by its path 166 * Delete a file specified by its path
167 * @param path Path relative to the archive 167 * @param path Path relative to the archive
168 * @return Result of the operation 168 * @return Result of the operation
169 */ 169 */
170 ResultCode DeleteFile(const std::string& path) const; 170 Result DeleteFile(const std::string& path) const;
171 171
172 /** 172 /**
173 * Create a directory specified by its path 173 * Create a directory specified by its path
174 * @param path Path relative to the archive 174 * @param path Path relative to the archive
175 * @return Result of the operation 175 * @return Result of the operation
176 */ 176 */
177 ResultCode CreateDirectory(const std::string& path) const; 177 Result CreateDirectory(const std::string& path) const;
178 178
179 /** 179 /**
180 * Delete a directory specified by its path 180 * Delete a directory specified by its path
181 * @param path Path relative to the archive 181 * @param path Path relative to the archive
182 * @return Result of the operation 182 * @return Result of the operation
183 */ 183 */
184 ResultCode DeleteDirectory(const std::string& path) const; 184 Result DeleteDirectory(const std::string& path) const;
185 185
186 /** 186 /**
187 * Delete a directory specified by its path and anything under it 187 * Delete a directory specified by its path and anything under it
188 * @param path Path relative to the archive 188 * @param path Path relative to the archive
189 * @return Result of the operation 189 * @return Result of the operation
190 */ 190 */
191 ResultCode DeleteDirectoryRecursively(const std::string& path) const; 191 Result DeleteDirectoryRecursively(const std::string& path) const;
192 192
193 /** 193 /**
194 * Cleans the specified directory. This is similar to DeleteDirectoryRecursively, 194 * Cleans the specified directory. This is similar to DeleteDirectoryRecursively,
@@ -200,7 +200,7 @@ public:
200 * 200 *
201 * @return Result of the operation. 201 * @return Result of the operation.
202 */ 202 */
203 ResultCode CleanDirectoryRecursively(const std::string& path) const; 203 Result CleanDirectoryRecursively(const std::string& path) const;
204 204
205 /** 205 /**
206 * Rename a File specified by its path 206 * Rename a File specified by its path
@@ -208,7 +208,7 @@ public:
208 * @param dest_path Destination path relative to the archive 208 * @param dest_path Destination path relative to the archive
209 * @return Result of the operation 209 * @return Result of the operation
210 */ 210 */
211 ResultCode RenameFile(const std::string& src_path, const std::string& dest_path) const; 211 Result RenameFile(const std::string& src_path, const std::string& dest_path) const;
212 212
213 /** 213 /**
214 * Rename a Directory specified by its path 214 * Rename a Directory specified by its path
@@ -216,7 +216,7 @@ public:
216 * @param dest_path Destination path relative to the archive 216 * @param dest_path Destination path relative to the archive
217 * @return Result of the operation 217 * @return Result of the operation
218 */ 218 */
219 ResultCode RenameDirectory(const std::string& src_path, const std::string& dest_path) const; 219 Result RenameDirectory(const std::string& src_path, const std::string& dest_path) const;
220 220
221 /** 221 /**
222 * Open a file specified by its path, using the specified mode 222 * Open a file specified by its path, using the specified mode