diff options
| author | 2014-11-23 23:20:04 -0800 | |
|---|---|---|
| committer | 2014-11-24 15:09:11 -0800 | |
| commit | 45afc15aa6b9b1798a321bc053171deb765d7681 (patch) | |
| tree | 54da02809c463f89462c3b29a48fb1564f699f01 /src/core/file_sys | |
| parent | Merge pull request #147 from yuriks/error-codes (diff) | |
| download | yuzu-45afc15aa6b9b1798a321bc053171deb765d7681.tar.gz yuzu-45afc15aa6b9b1798a321bc053171deb765d7681.tar.xz yuzu-45afc15aa6b9b1798a321bc053171deb765d7681.zip | |
Implemented RenameFile in FS:USER
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/archive.h | 8 | ||||
| -rw-r--r-- | src/core/file_sys/archive_romfs.cpp | 11 | ||||
| -rw-r--r-- | src/core/file_sys/archive_romfs.h | 8 | ||||
| -rw-r--r-- | src/core/file_sys/archive_sdmc.cpp | 10 | ||||
| -rw-r--r-- | src/core/file_sys/archive_sdmc.h | 8 |
5 files changed, 45 insertions, 0 deletions
diff --git a/src/core/file_sys/archive.h b/src/core/file_sys/archive.h index 2e79bb883..703742a1f 100644 --- a/src/core/file_sys/archive.h +++ b/src/core/file_sys/archive.h | |||
| @@ -192,6 +192,14 @@ public: | |||
| 192 | virtual bool DeleteFile(const FileSys::Path& path) const = 0; | 192 | virtual bool DeleteFile(const FileSys::Path& path) const = 0; |
| 193 | 193 | ||
| 194 | /** | 194 | /** |
| 195 | * Rename a File specified by its path | ||
| 196 | * @param src_path Source path relative to the archive | ||
| 197 | * @param dest_path Destination path relative to the archive | ||
| 198 | * @return Whether rename succeeded | ||
| 199 | */ | ||
| 200 | virtual bool RenameFile(const FileSys::Path& src_path, const FileSys::Path& dest_path) const = 0; | ||
| 201 | |||
| 202 | /** | ||
| 195 | * Delete a directory specified by its path | 203 | * Delete a directory specified by its path |
| 196 | * @param path Path relative to the archive | 204 | * @param path Path relative to the archive |
| 197 | * @return Whether the directory could be deleted | 205 | * @return Whether the directory could be deleted |
diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp index 53dc57954..5594c5910 100644 --- a/src/core/file_sys/archive_romfs.cpp +++ b/src/core/file_sys/archive_romfs.cpp | |||
| @@ -44,6 +44,17 @@ bool Archive_RomFS::DeleteFile(const FileSys::Path& path) const { | |||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | /** | 46 | /** |
| 47 | * Rename a File specified by its path | ||
| 48 | * @param src_path Source path relative to the archive | ||
| 49 | * @param dest_path Destination path relative to the archive | ||
| 50 | * @return Whether rename succeeded | ||
| 51 | */ | ||
| 52 | bool Archive_RomFS::RenameFile(const FileSys::Path& src_path, const FileSys::Path& dest_path) const { | ||
| 53 | ERROR_LOG(FILESYS, "Attempted to rename a file within ROMFS."); | ||
| 54 | return false; | ||
| 55 | } | ||
| 56 | |||
| 57 | /** | ||
| 47 | * Delete a directory specified by its path | 58 | * Delete a directory specified by its path |
| 48 | * @param path Path relative to the archive | 59 | * @param path Path relative to the archive |
| 49 | * @return Whether the directory could be deleted | 60 | * @return Whether the directory could be deleted |
diff --git a/src/core/file_sys/archive_romfs.h b/src/core/file_sys/archive_romfs.h index 0649dde99..d14372a01 100644 --- a/src/core/file_sys/archive_romfs.h +++ b/src/core/file_sys/archive_romfs.h | |||
| @@ -44,6 +44,14 @@ public: | |||
| 44 | bool DeleteFile(const FileSys::Path& path) const override; | 44 | bool DeleteFile(const FileSys::Path& path) const override; |
| 45 | 45 | ||
| 46 | /** | 46 | /** |
| 47 | * Rename a File specified by its path | ||
| 48 | * @param src_path Source path relative to the archive | ||
| 49 | * @param dest_path Destination path relative to the archive | ||
| 50 | * @return Whether rename succeeded | ||
| 51 | */ | ||
| 52 | bool RenameFile(const FileSys::Path& src_path, const FileSys::Path& dest_path) const override; | ||
| 53 | |||
| 54 | /** | ||
| 47 | * Delete a directory specified by its path | 55 | * Delete a directory specified by its path |
| 48 | * @param path Path relative to the archive | 56 | * @param path Path relative to the archive |
| 49 | * @return Whether the directory could be deleted | 57 | * @return Whether the directory could be deleted |
diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp index c2ffcd40d..24bc43a02 100644 --- a/src/core/file_sys/archive_sdmc.cpp +++ b/src/core/file_sys/archive_sdmc.cpp | |||
| @@ -67,6 +67,16 @@ bool Archive_SDMC::DeleteFile(const FileSys::Path& path) const { | |||
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | /** | 69 | /** |
| 70 | * Rename a File specified by its path | ||
| 71 | * @param src_path Source path relative to the archive | ||
| 72 | * @param dest_path Destination path relative to the archive | ||
| 73 | * @return Whether rename succeeded | ||
| 74 | */ | ||
| 75 | bool Archive_SDMC::RenameFile(const FileSys::Path& src_path, const FileSys::Path& dest_path) const { | ||
| 76 | return FileUtil::Rename(GetMountPoint() + src_path.AsString(), GetMountPoint() + dest_path.AsString()); | ||
| 77 | } | ||
| 78 | |||
| 79 | /** | ||
| 70 | * Delete a directory specified by its path | 80 | * Delete a directory specified by its path |
| 71 | * @param path Path relative to the archive | 81 | * @param path Path relative to the archive |
| 72 | * @return Whether the directory could be deleted | 82 | * @return Whether the directory could be deleted |
diff --git a/src/core/file_sys/archive_sdmc.h b/src/core/file_sys/archive_sdmc.h index 74ce29c0d..0dbed987b 100644 --- a/src/core/file_sys/archive_sdmc.h +++ b/src/core/file_sys/archive_sdmc.h | |||
| @@ -48,6 +48,14 @@ public: | |||
| 48 | bool DeleteFile(const FileSys::Path& path) const override; | 48 | bool DeleteFile(const FileSys::Path& path) const override; |
| 49 | 49 | ||
| 50 | /** | 50 | /** |
| 51 | * Rename a File specified by its path | ||
| 52 | * @param src_path Source path relative to the archive | ||
| 53 | * @param dest_path Destination path relative to the archive | ||
| 54 | * @return Whether rename succeeded | ||
| 55 | */ | ||
| 56 | bool RenameFile(const FileSys::Path& src_path, const FileSys::Path& dest_path) const override; | ||
| 57 | |||
| 58 | /** | ||
| 51 | * Delete a directory specified by its path | 59 | * Delete a directory specified by its path |
| 52 | * @param path Path relative to the archive | 60 | * @param path Path relative to the archive |
| 53 | * @return Whether the directory could be deleted | 61 | * @return Whether the directory could be deleted |