summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2014-12-05 04:07:47 +0100
committerbunnei <bunneidev@gmail.com>2014-12-05 04:07:47 +0100
commit5056329a8003115f61859b97c2fc6ef2f460a0d3 (patch)
tree9434ac214d06a5d55ff20848f57cb981647991dc /src/core/file_sys
parentMerge pull request #248 from lioncash/kernel (diff)
parentUpdated archive.cpp functions for proper error handling (diff)
downloadyuzu-5056329a8003115f61859b97c2fc6ef2f460a0d3.tar
yuzu-5056329a8003115f61859b97c2fc6ef2f460a0d3.tar.gz
yuzu-5056329a8003115f61859b97c2fc6ef2f460a0d3.tar.bz2
yuzu-5056329a8003115f61859b97c2fc6ef2f460a0d3.tar.lz
yuzu-5056329a8003115f61859b97c2fc6ef2f460a0d3.tar.xz
yuzu-5056329a8003115f61859b97c2fc6ef2f460a0d3.tar.zst
yuzu-5056329a8003115f61859b97c2fc6ef2f460a0d3.zip
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/archive.h16
-rw-r--r--src/core/file_sys/archive_romfs.cpp10
-rw-r--r--src/core/file_sys/archive_romfs.h16
-rw-r--r--src/core/file_sys/archive_sdmc.cpp8
-rw-r--r--src/core/file_sys/archive_sdmc.h16
5 files changed, 66 insertions, 0 deletions
diff --git a/src/core/file_sys/archive.h b/src/core/file_sys/archive.h
index c2426a153..f3cb11133 100644
--- a/src/core/file_sys/archive.h
+++ b/src/core/file_sys/archive.h
@@ -194,6 +194,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
@@ -208,6 +216,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
* @return Opened directory, or nullptr
diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp
index 53dc57954..8c2dbeda5 100644
--- a/src/core/file_sys/archive_romfs.cpp
+++ b/src/core/file_sys/archive_romfs.cpp
@@ -43,6 +43,11 @@ bool Archive_RomFS::DeleteFile(const FileSys::Path& path) const {
return false;
}
+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
@@ -63,6 +68,11 @@ bool Archive_RomFS::CreateDirectory(const Path& path) const {
return false;
}
+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 0649dde99..222bdc356 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
@@ -58,6 +66,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
* @return Opened directory, or nullptr
diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp
index 789212b17..169ab0f1c 100644
--- a/src/core/file_sys/archive_sdmc.cpp
+++ b/src/core/file_sys/archive_sdmc.cpp
@@ -66,6 +66,10 @@ bool Archive_SDMC::DeleteFile(const FileSys::Path& path) const {
return FileUtil::Delete(GetMountPoint() + path.AsString());
}
+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
@@ -84,6 +88,10 @@ bool Archive_SDMC::CreateDirectory(const Path& path) const {
return FileUtil::CreateDir(GetMountPoint() + path.AsString());
}
+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 74ce29c0d..19f563a62 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
@@ -62,6 +70,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
* @return Opened directory, or nullptr