Merge pull request #222 from archshift/renamexyz
Implemented RenameFile and RenameDirectory in FS:USER
This commit is contained in:
commit
5056329a80
8 changed files with 229 additions and 38 deletions
|
@ -193,6 +193,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
|
||||
|
@ -207,6 +215,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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -43,6 +43,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
|
||||
|
@ -57,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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -47,6 +47,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
|
||||
|
@ -61,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue