summaryrefslogtreecommitdiff
path: root/src/core/file_sys/vfs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/file_sys/vfs.h')
-rw-r--r--src/core/file_sys/vfs.h28
1 files changed, 0 insertions, 28 deletions
diff --git a/src/core/file_sys/vfs.h b/src/core/file_sys/vfs.h
index 7f0d520ca..09dc9f288 100644
--- a/src/core/file_sys/vfs.h
+++ b/src/core/file_sys/vfs.h
@@ -262,36 +262,8 @@ public:
262 // item name -> type. 262 // item name -> type.
263 virtual std::map<std::string, VfsEntryType, std::less<>> GetEntries() const; 263 virtual std::map<std::string, VfsEntryType, std::less<>> GetEntries() const;
264 264
265 // Interprets the file with name file instead as a directory of type directory.
266 // The directory must have a constructor that takes a single argument of type
267 // std::shared_ptr<VfsFile>. Allows to reinterpret container files (i.e NCA, zip, XCI, etc) as a
268 // subdirectory in one call.
269 template <typename Directory>
270 bool InterpretAsDirectory(std::string_view file) {
271 auto file_p = GetFile(file);
272
273 if (file_p == nullptr) {
274 return false;
275 }
276
277 return ReplaceFileWithSubdirectory(file_p, std::make_shared<Directory>(file_p));
278 }
279
280 bool InterpretAsDirectory(const std::function<VirtualDir(VirtualFile)>& function,
281 const std::string& file) {
282 auto file_p = GetFile(file);
283 if (file_p == nullptr)
284 return false;
285 return ReplaceFileWithSubdirectory(file_p, function(file_p));
286 }
287
288 // Returns the full path of this directory as a string, recursively 265 // Returns the full path of this directory as a string, recursively
289 virtual std::string GetFullPath() const; 266 virtual std::string GetFullPath() const;
290
291protected:
292 // Backend for InterpretAsDirectory.
293 // Removes all references to file and adds a reference to dir in the directory's implementation.
294 virtual bool ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) = 0;
295}; 267};
296 268
297// A convenience partial-implementation of VfsDirectory that stubs out methods that should only work 269// A convenience partial-implementation of VfsDirectory that stubs out methods that should only work