diff options
author | archshift <admin@archshift.com> | 2014-11-23 23:20:04 -0800 |
---|---|---|
committer | archshift <admin@archshift.com> | 2014-11-24 15:09:11 -0800 |
commit | 45afc15aa6b9b1798a321bc053171deb765d7681 (patch) | |
tree | 54da02809c463f89462c3b29a48fb1564f699f01 /src/core/file_sys | |
parent | bb730855e58d18d8964d158a55822c40503d548f (diff) |
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 2e79bb88..703742a1 100644 --- a/src/core/file_sys/archive.h +++ b/src/core/file_sys/archive.h @@ -192,6 +192,14 @@ public: virtual bool DeleteFile(const FileSys::Path& path) const = 0; /** + * Rename a File specified by its path + * @param src_path Source path relative to the archive + * @param dest_path Destination path relative to the archive + * @return Whether rename succeeded + */ + virtual bool RenameFile(const FileSys::Path& src_path, const FileSys::Path& dest_path) const = 0; + + /** * Delete a directory specified by its path * @param path Path relative to the archive * @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 53dc5795..5594c591 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 { } /** + * Rename a File specified by its path + * @param src_path Source path relative to the archive + * @param dest_path Destination path relative to the archive + * @return Whether rename succeeded + */ +bool Archive_RomFS::RenameFile(const FileSys::Path& src_path, const FileSys::Path& dest_path) const { + ERROR_LOG(FILESYS, "Attempted to rename a file within ROMFS."); + return false; +} + +/** * Delete a directory specified by its path * @param path Path relative to the archive * @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 0649dde9..d14372a0 100644 --- a/src/core/file_sys/archive_romfs.h +++ b/src/core/file_sys/archive_romfs.h @@ -44,6 +44,14 @@ public: bool DeleteFile(const FileSys::Path& path) const override; /** + * Rename a File specified by its path + * @param src_path Source path relative to the archive + * @param dest_path Destination path relative to the archive + * @return Whether rename succeeded + */ + bool RenameFile(const FileSys::Path& src_path, const FileSys::Path& dest_path) const override; + + /** * Delete a directory specified by its path * @param path Path relative to the archive * @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 c2ffcd40..24bc43a0 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 { } /** + * Rename a File specified by its path + * @param src_path Source path relative to the archive + * @param dest_path Destination path relative to the archive + * @return Whether rename succeeded + */ +bool Archive_SDMC::RenameFile(const FileSys::Path& src_path, const FileSys::Path& dest_path) const { + return FileUtil::Rename(GetMountPoint() + src_path.AsString(), GetMountPoint() + dest_path.AsString()); +} + +/** * Delete a directory specified by its path * @param path Path relative to the archive * @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 74ce29c0..0dbed987 100644 --- a/src/core/file_sys/archive_sdmc.h +++ b/src/core/file_sys/archive_sdmc.h @@ -48,6 +48,14 @@ public: bool DeleteFile(const FileSys::Path& path) const override; /** + * Rename a File specified by its path + * @param src_path Source path relative to the archive + * @param dest_path Destination path relative to the archive + * @return Whether rename succeeded + */ + bool RenameFile(const FileSys::Path& src_path, const FileSys::Path& dest_path) const override; + + /** * Delete a directory specified by its path * @param path Path relative to the archive * @return Whether the directory could be deleted |