fs: implement DeleteDirectoryRecursively

This commit is contained in:
wwylele 2016-10-02 11:29:04 +08:00
parent 4b14e17b18
commit 96b0e9476b
8 changed files with 70 additions and 1 deletions

View file

@ -111,6 +111,13 @@ public:
*/
virtual bool DeleteDirectory(const Path& path) const = 0;
/**
* Delete a directory specified by its path and anything under it
* @param path Path relative to the archive
* @return Whether the directory could be deleted
*/
virtual bool DeleteDirectoryRecursively(const Path& path) const = 0;
/**
* Create a file specified by its path
* @param path Path relative to the Archive

View file

@ -51,6 +51,10 @@ bool DiskArchive::DeleteDirectory(const Path& path) const {
return FileUtil::DeleteDir(mount_point + path.AsString());
}
bool DiskArchive::DeleteDirectoryRecursively(const Path& path) const {
return FileUtil::DeleteDirRecursively(mount_point + path.AsString());
}
ResultCode DiskArchive::CreateFile(const FileSys::Path& path, u64 size) const {
std::string full_path = mount_point + path.AsString();

View file

@ -38,6 +38,7 @@ public:
ResultCode DeleteFile(const Path& path) const override;
bool RenameFile(const Path& src_path, const Path& dest_path) const override;
bool DeleteDirectory(const Path& path) const override;
bool DeleteDirectoryRecursively(const Path& path) const override;
ResultCode CreateFile(const Path& path, u64 size) const override;
bool CreateDirectory(const Path& path) const override;
bool RenameDirectory(const Path& src_path, const Path& dest_path) const override;

View file

@ -43,6 +43,12 @@ bool IVFCArchive::DeleteDirectory(const Path& path) const {
return false;
}
bool IVFCArchive::DeleteDirectoryRecursively(const Path& path) const {
LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an IVFC archive (%s).",
GetName().c_str());
return false;
}
ResultCode IVFCArchive::CreateFile(const Path& path, u64 size) const {
LOG_CRITICAL(Service_FS, "Attempted to create a file in an IVFC archive (%s).",
GetName().c_str());

View file

@ -37,6 +37,7 @@ public:
ResultCode DeleteFile(const Path& path) const override;
bool RenameFile(const Path& src_path, const Path& dest_path) const override;
bool DeleteDirectory(const Path& path) const override;
bool DeleteDirectoryRecursively(const Path& path) const override;
ResultCode CreateFile(const Path& path, u64 size) const override;
bool CreateDirectory(const Path& path) const override;
bool RenameDirectory(const Path& src_path, const Path& dest_path) const override;