diff options
author | archshift <admin@archshift.com> | 2014-11-11 19:37:26 +0100 |
---|---|---|
committer | archshift <admin@archshift.com> | 2014-11-23 09:33:43 +0100 |
commit | 8aeadbd95a85e2d42d282897d7d286d645d61f27 (patch) | |
tree | 5cc15bf131a6cfb3e6a0834e07ca2d007f612a7e /src/core/file_sys | |
parent | Merge pull request #192 from bunnei/fs-fix-paths (diff) | |
download | yuzu-8aeadbd95a85e2d42d282897d7d286d645d61f27.tar yuzu-8aeadbd95a85e2d42d282897d7d286d645d61f27.tar.gz yuzu-8aeadbd95a85e2d42d282897d7d286d645d61f27.tar.bz2 yuzu-8aeadbd95a85e2d42d282897d7d286d645d61f27.tar.lz yuzu-8aeadbd95a85e2d42d282897d7d286d645d61f27.tar.xz yuzu-8aeadbd95a85e2d42d282897d7d286d645d61f27.tar.zst yuzu-8aeadbd95a85e2d42d282897d7d286d645d61f27.zip |
Diffstat (limited to 'src/core/file_sys')
-rw-r--r-- | src/core/file_sys/archive.h | 14 | ||||
-rw-r--r-- | src/core/file_sys/archive_romfs.cpp | 20 | ||||
-rw-r--r-- | src/core/file_sys/archive_romfs.h | 14 | ||||
-rw-r--r-- | src/core/file_sys/archive_sdmc.cpp | 18 | ||||
-rw-r--r-- | src/core/file_sys/archive_sdmc.h | 14 |
5 files changed, 80 insertions, 0 deletions
diff --git a/src/core/file_sys/archive.h b/src/core/file_sys/archive.h index dc2d2ced9..4cf47f30a 100644 --- a/src/core/file_sys/archive.h +++ b/src/core/file_sys/archive.h @@ -185,6 +185,20 @@ public: virtual std::unique_ptr<File> OpenFile(const Path& path, const Mode mode) const = 0; /** + * Delete a file specified by its path + * @param path Path relative to the archive + * @return Whether the file could be deleted + */ + virtual bool DeleteFile(const FileSys::Path& path) const = 0; + + /** + * Delete a directory specified by its path + * @param path Path relative to the archive + * @return Whether the directory could be deleted + */ + virtual bool DeleteDirectory(const FileSys::Path& path) const = 0; + + /** * Create a directory specified by its path * @param path Path relative to the archive * @return Whether the directory could be created diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp index 3ea60134f..05fc1f87f 100644 --- a/src/core/file_sys/archive_romfs.cpp +++ b/src/core/file_sys/archive_romfs.cpp @@ -34,6 +34,26 @@ std::unique_ptr<File> Archive_RomFS::OpenFile(const Path& path, const Mode mode) } /** + * Delete a file specified by its path + * @param path Path relative to the archive + * @return Whether the file could be deleted + */ +bool Archive_RomFS::DeleteFile(const FileSys::Path& path) const { + ERROR_LOG(FILESYS, "Attempted to delete a file from ROMFS."); + return false; +} + +/** + * Delete a directory specified by its path + * @param path Path relative to the archive + * @return Whether the directory could be deleted + */ +bool Archive_RomFS::DeleteDirectory(const FileSys::Path& path) const { + ERROR_LOG(FILESYS, "Attempted to delete a directory from ROMFS."); + return false; +} + +/** * Create a directory specified by its path * @param path Path relative to the archive * @return Whether the directory could be created diff --git a/src/core/file_sys/archive_romfs.h b/src/core/file_sys/archive_romfs.h index 8d5715734..aa6446c51 100644 --- a/src/core/file_sys/archive_romfs.h +++ b/src/core/file_sys/archive_romfs.h @@ -37,6 +37,20 @@ public: std::unique_ptr<File> OpenFile(const Path& path, const Mode mode) const override; /** + * Delete a file specified by its path + * @param path Path relative to the archive + * @return Whether the file could be deleted + */ + bool DeleteFile(const FileSys::Path& path) const override; + + /** + * Delete a directory specified by its path + * @param path Path relative to the archive + * @return Whether the directory could be deleted + */ + bool DeleteDirectory(const FileSys::Path& path) const override; + + /** * Create a directory specified by its path * @param path Path relative to the archive * @return Whether the directory could be created diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp index ecdb7f211..c2ffcd40d 100644 --- a/src/core/file_sys/archive_sdmc.cpp +++ b/src/core/file_sys/archive_sdmc.cpp @@ -58,6 +58,24 @@ std::unique_ptr<File> Archive_SDMC::OpenFile(const Path& path, const Mode mode) } /** + * Delete a file specified by its path + * @param path Path relative to the archive + * @return Whether the file could be deleted + */ +bool Archive_SDMC::DeleteFile(const FileSys::Path& path) const { + return FileUtil::Delete(GetMountPoint() + path.AsString()); +} + +/** + * Delete a directory specified by its path + * @param path Path relative to the archive + * @return Whether the directory could be deleted + */ +bool Archive_SDMC::DeleteDirectory(const FileSys::Path& path) const { + return FileUtil::DeleteDir(GetMountPoint() + path.AsString()); +} + +/** * Create a directory specified by its path * @param path Path relative to the archive * @return Whether the directory could be created diff --git a/src/core/file_sys/archive_sdmc.h b/src/core/file_sys/archive_sdmc.h index 1f621b3f7..8ac06484c 100644 --- a/src/core/file_sys/archive_sdmc.h +++ b/src/core/file_sys/archive_sdmc.h @@ -41,6 +41,20 @@ public: std::unique_ptr<File> OpenFile(const Path& path, const Mode mode) const override; /** + * Delete a file specified by its path + * @param path Path relative to the archive + * @return Whether the file could be deleted + */ + bool DeleteFile(const FileSys::Path& path) const override; + + /** + * Delete a directory specified by its path + * @param path Path relative to the archive + * @return Whether the directory could be deleted + */ + bool DeleteDirectory(const FileSys::Path& path) const override; + + /** * Create a directory specified by its path * @param path Path relative to the archive * @return Whether the directory could be created |