diff options
| author | 2018-10-02 20:04:31 -0400 | |
|---|---|---|
| committer | 2018-10-19 14:02:07 -0400 | |
| commit | a25d79cfaad99e7659a8123d41dc0969e854259b (patch) | |
| tree | ca5adf2b2f4e944099cbe672c0819d841294d64d /src/core/file_sys/vfs.h | |
| parent | Merge pull request #1525 from ogniK5377/block-home (diff) | |
| download | yuzu-a25d79cfaad99e7659a8123d41dc0969e854259b.tar.gz yuzu-a25d79cfaad99e7659a8123d41dc0969e854259b.tar.xz yuzu-a25d79cfaad99e7659a8123d41dc0969e854259b.zip | |
vfs: Remove InterpretAsDirectory and related functions
When writing VFS, it initally seemed useful to include a function to in-place convert container files into directories in one homogenous directory structure, but re-evaluating it now there have been plenty of chances to use it and there has always been a better way. Removing as it is unused and likely will not be used.
Diffstat (limited to 'src/core/file_sys/vfs.h')
| -rw-r--r-- | src/core/file_sys/vfs.h | 28 |
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 | |||
| 291 | protected: | ||
| 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 |