diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-07-28 00:14:03 +0200 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-07-28 00:14:03 +0200 |
commit | 906d785c73cb3644e8984fbfcbf5fcb8a1ebbc6f (patch) | |
tree | beff5b868534a8bfb4eea7992553fa5fb5db5287 /src/core/file_sys/vfs.h | |
parent | Merge pull request #845 from lioncash/nfc (diff) | |
download | yuzu-906d785c73cb3644e8984fbfcbf5fcb8a1ebbc6f.tar yuzu-906d785c73cb3644e8984fbfcbf5fcb8a1ebbc6f.tar.gz yuzu-906d785c73cb3644e8984fbfcbf5fcb8a1ebbc6f.tar.bz2 yuzu-906d785c73cb3644e8984fbfcbf5fcb8a1ebbc6f.tar.lz yuzu-906d785c73cb3644e8984fbfcbf5fcb8a1ebbc6f.tar.xz yuzu-906d785c73cb3644e8984fbfcbf5fcb8a1ebbc6f.tar.zst yuzu-906d785c73cb3644e8984fbfcbf5fcb8a1ebbc6f.zip |
Diffstat (limited to 'src/core/file_sys/vfs.h')
-rw-r--r-- | src/core/file_sys/vfs.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/core/file_sys/vfs.h b/src/core/file_sys/vfs.h index 4a13b8378..cf871edd6 100644 --- a/src/core/file_sys/vfs.h +++ b/src/core/file_sys/vfs.h @@ -113,6 +113,9 @@ struct VfsFile : NonCopyable { // Renames the file to name. Returns whether or not the operation was successsful. virtual bool Rename(std::string_view name) = 0; + + // Returns the full path of this file as a string, recursively + virtual std::string GetFullPath() const; }; // A class representing a directory in an abstract filesystem. @@ -213,6 +216,17 @@ struct VfsDirectory : NonCopyable { return ReplaceFileWithSubdirectory(file_p, std::make_shared<Directory>(file_p)); } + bool InterpretAsDirectory(const std::function<VirtualDir(VirtualFile)>& function, + const std::string& file) { + auto file_p = GetFile(file); + if (file_p == nullptr) + return false; + return ReplaceFileWithSubdirectory(file_p, function(file_p)); + } + + // Returns the full path of this directory as a string, recursively + virtual std::string GetFullPath() const; + protected: // Backend for InterpretAsDirectory. // Removes all references to file and adds a reference to dir in the directory's implementation. @@ -230,4 +244,10 @@ struct ReadOnlyVfsDirectory : public VfsDirectory { bool DeleteFile(std::string_view name) override; bool Rename(std::string_view name) override; }; + +// A method that copies the raw data between two different implementations of VirtualFile. If you +// are using the same implementation, it is probably better to use the Copy method in the parent +// directory of src/dest. +bool VfsRawCopy(VirtualFile src, VirtualFile dest); + } // namespace FileSys |