Merge pull request #191 from archshift/deletexyz
Added DeleteFile and DeleteDirectory functions to FS:USER and the archives.
This commit is contained in:
commit
ef1b16a7eb
8 changed files with 194 additions and 26 deletions
|
@ -184,6 +184,20 @@ public:
|
|||
*/
|
||||
virtual std::unique_ptr<File> OpenFile(const Path& path, const Mode mode) const = 0;
|
||||
|
||||
/**
|
||||
* Delete a file specified by its path
|
||||
* @param path Path relative to the archive
|
||||
* @return Whether the file could be deleted
|
||||
*/
|
||||
virtual bool DeleteFile(const FileSys::Path& path) const = 0;
|
||||
|
||||
/**
|
||||
* Delete a directory specified by its path
|
||||
* @param path Path relative to the archive
|
||||
* @return Whether the directory could be deleted
|
||||
*/
|
||||
virtual bool DeleteDirectory(const FileSys::Path& path) const = 0;
|
||||
|
||||
/**
|
||||
* Create a directory specified by its path
|
||||
* @param path Path relative to the archive
|
||||
|
|
|
@ -33,6 +33,26 @@ std::unique_ptr<File> Archive_RomFS::OpenFile(const Path& path, const Mode mode)
|
|||
return std::unique_ptr<File>(new File_RomFS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a file specified by its path
|
||||
* @param path Path relative to the archive
|
||||
* @return Whether the file could be deleted
|
||||
*/
|
||||
bool Archive_RomFS::DeleteFile(const FileSys::Path& path) const {
|
||||
ERROR_LOG(FILESYS, "Attempted to delete a file from ROMFS.");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a directory specified by its path
|
||||
* @param path Path relative to the archive
|
||||
* @return Whether the directory could be deleted
|
||||
*/
|
||||
bool Archive_RomFS::DeleteDirectory(const FileSys::Path& path) const {
|
||||
ERROR_LOG(FILESYS, "Attempted to delete a directory from ROMFS.");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a directory specified by its path
|
||||
* @param path Path relative to the archive
|
||||
|
|
|
@ -36,6 +36,20 @@ public:
|
|||
*/
|
||||
std::unique_ptr<File> OpenFile(const Path& path, const Mode mode) const override;
|
||||
|
||||
/**
|
||||
* Delete a file specified by its path
|
||||
* @param path Path relative to the archive
|
||||
* @return Whether the file could be deleted
|
||||
*/
|
||||
bool DeleteFile(const FileSys::Path& path) const override;
|
||||
|
||||
/**
|
||||
* Delete a directory specified by its path
|
||||
* @param path Path relative to the archive
|
||||
* @return Whether the directory could be deleted
|
||||
*/
|
||||
bool DeleteDirectory(const FileSys::Path& path) const override;
|
||||
|
||||
/**
|
||||
* Create a directory specified by its path
|
||||
* @param path Path relative to the archive
|
||||
|
|
|
@ -57,6 +57,24 @@ std::unique_ptr<File> Archive_SDMC::OpenFile(const Path& path, const Mode mode)
|
|||
return std::unique_ptr<File>(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a file specified by its path
|
||||
* @param path Path relative to the archive
|
||||
* @return Whether the file could be deleted
|
||||
*/
|
||||
bool Archive_SDMC::DeleteFile(const FileSys::Path& path) const {
|
||||
return FileUtil::Delete(GetMountPoint() + path.AsString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a directory specified by its path
|
||||
* @param path Path relative to the archive
|
||||
* @return Whether the directory could be deleted
|
||||
*/
|
||||
bool Archive_SDMC::DeleteDirectory(const FileSys::Path& path) const {
|
||||
return FileUtil::DeleteDir(GetMountPoint() + path.AsString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a directory specified by its path
|
||||
* @param path Path relative to the archive
|
||||
|
|
|
@ -40,6 +40,20 @@ public:
|
|||
*/
|
||||
std::unique_ptr<File> OpenFile(const Path& path, const Mode mode) const override;
|
||||
|
||||
/**
|
||||
* Delete a file specified by its path
|
||||
* @param path Path relative to the archive
|
||||
* @return Whether the file could be deleted
|
||||
*/
|
||||
bool DeleteFile(const FileSys::Path& path) const override;
|
||||
|
||||
/**
|
||||
* Delete a directory specified by its path
|
||||
* @param path Path relative to the archive
|
||||
* @return Whether the directory could be deleted
|
||||
*/
|
||||
bool DeleteDirectory(const FileSys::Path& path) const override;
|
||||
|
||||
/**
|
||||
* Create a directory specified by its path
|
||||
* @param path Path relative to the archive
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue