From e5ff01c2cde0fe903140f0215461a68d4f489132 Mon Sep 17 00:00:00 2001 From: archshift Date: Mon, 24 Nov 2014 01:12:58 -0800 Subject: Implemented RenameDirectory in FS:USER --- src/core/file_sys/archive.h | 8 ++++++++ src/core/file_sys/archive_romfs.cpp | 11 +++++++++++ src/core/file_sys/archive_romfs.h | 8 ++++++++ src/core/file_sys/archive_sdmc.cpp | 10 ++++++++++ src/core/file_sys/archive_sdmc.h | 8 ++++++++ 5 files changed, 45 insertions(+) (limited to 'src/core/file_sys') diff --git a/src/core/file_sys/archive.h b/src/core/file_sys/archive.h index 703742a1f..5ea75361e 100644 --- a/src/core/file_sys/archive.h +++ b/src/core/file_sys/archive.h @@ -213,6 +213,14 @@ public: */ virtual bool CreateDirectory(const Path& path) const = 0; + /** + * Rename a Directory 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 RenameDirectory(const FileSys::Path& src_path, const FileSys::Path& dest_path) const = 0; + /** * Open a directory specified by its path * @param path Path relative to the archive diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp index 5594c5910..d0ca7d380 100644 --- a/src/core/file_sys/archive_romfs.cpp +++ b/src/core/file_sys/archive_romfs.cpp @@ -74,6 +74,17 @@ bool Archive_RomFS::CreateDirectory(const Path& path) const { return false; } +/** + * Rename a Directory 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::RenameDirectory(const FileSys::Path& src_path, const FileSys::Path& dest_path) const { + ERROR_LOG(FILESYS, "Attempted to rename a file within ROMFS."); + return false; +} + /** * Open a directory specified by its path * @param path Path relative to the archive diff --git a/src/core/file_sys/archive_romfs.h b/src/core/file_sys/archive_romfs.h index d14372a01..222bdc356 100644 --- a/src/core/file_sys/archive_romfs.h +++ b/src/core/file_sys/archive_romfs.h @@ -65,6 +65,14 @@ public: */ bool CreateDirectory(const Path& path) const override; + /** + * Rename a Directory 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 RenameDirectory(const FileSys::Path& src_path, const FileSys::Path& dest_path) const override; + /** * Open a directory specified by its path * @param path Path relative to the archive diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp index 24bc43a02..c8958a0eb 100644 --- a/src/core/file_sys/archive_sdmc.cpp +++ b/src/core/file_sys/archive_sdmc.cpp @@ -94,6 +94,16 @@ bool Archive_SDMC::CreateDirectory(const Path& path) const { return FileUtil::CreateDir(GetMountPoint() + path.AsString()); } +/** + * Rename a Directory 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::RenameDirectory(const FileSys::Path& src_path, const FileSys::Path& dest_path) const { + return FileUtil::Rename(GetMountPoint() + src_path.AsString(), GetMountPoint() + dest_path.AsString()); +} + /** * Open a directory specified by its path * @param path Path relative to the archive diff --git a/src/core/file_sys/archive_sdmc.h b/src/core/file_sys/archive_sdmc.h index 0dbed987b..19f563a62 100644 --- a/src/core/file_sys/archive_sdmc.h +++ b/src/core/file_sys/archive_sdmc.h @@ -69,6 +69,14 @@ public: */ bool CreateDirectory(const Path& path) const override; + /** + * Rename a Directory 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 RenameDirectory(const FileSys::Path& src_path, const FileSys::Path& dest_path) const override; + /** * Open a directory specified by its path * @param path Path relative to the archive -- cgit v1.2.3