HLE/FS: Corrected the error codes for DeleteFile
This commit is contained in:
parent
b350f192bb
commit
09b0564c75
@ -83,9 +83,9 @@ public:
|
||||
/**
|
||||
* Delete a file specified by its path
|
||||
* @param path Path relative to the archive
|
||||
* @return Whether the file could be deleted
|
||||
* @return Result of the operation
|
||||
*/
|
||||
virtual bool DeleteFile(const Path& path) const = 0;
|
||||
virtual ResultCode DeleteFile(const Path& path) const = 0;
|
||||
|
||||
/**
|
||||
* Rename a File specified by its path
|
||||
|
@ -25,8 +25,19 @@ std::unique_ptr<FileBackend> DiskArchive::OpenFile(const Path& path, const Mode
|
||||
return std::move(file);
|
||||
}
|
||||
|
||||
bool DiskArchive::DeleteFile(const Path& path) const {
|
||||
return FileUtil::Delete(mount_point + path.AsString());
|
||||
ResultCode DiskArchive::DeleteFile(const Path& path) const {
|
||||
std::string file_path = mount_point + path.AsString();
|
||||
|
||||
if (FileUtil::IsDirectory(file_path))
|
||||
return ResultCode(ErrorDescription::FS_NotAFile, ErrorModule::FS, ErrorSummary::Canceled, ErrorLevel::Status);
|
||||
|
||||
if (!FileUtil::Exists(file_path))
|
||||
return ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS, ErrorSummary::NotFound, ErrorLevel::Status);
|
||||
|
||||
if (FileUtil::Delete(file_path))
|
||||
return RESULT_SUCCESS;
|
||||
|
||||
return ResultCode(ErrorDescription::FS_NotAFile, ErrorModule::FS, ErrorSummary::Canceled, ErrorLevel::Status);
|
||||
}
|
||||
|
||||
bool DiskArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
virtual std::string GetName() const override { return "DiskArchive: " + mount_point; }
|
||||
|
||||
std::unique_ptr<FileBackend> OpenFile(const Path& path, const Mode mode) const override;
|
||||
bool DeleteFile(const Path& path) const override;
|
||||
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;
|
||||
ResultCode CreateFile(const Path& path, u64 size) const override;
|
||||
|
@ -24,9 +24,11 @@ std::unique_ptr<FileBackend> IVFCArchive::OpenFile(const Path& path, const Mode
|
||||
return Common::make_unique<IVFCFile>(romfs_file, data_offset, data_size);
|
||||
}
|
||||
|
||||
bool IVFCArchive::DeleteFile(const Path& path) const {
|
||||
ResultCode IVFCArchive::DeleteFile(const Path& path) const {
|
||||
LOG_CRITICAL(Service_FS, "Attempted to delete a file from an IVFC archive (%s).", GetName().c_str());
|
||||
return false;
|
||||
// TODO(Subv): Verify error code
|
||||
return ResultCode(ErrorDescription::NoData, ErrorModule::FS,
|
||||
ErrorSummary::Canceled, ErrorLevel::Status);
|
||||
}
|
||||
|
||||
bool IVFCArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
std::string GetName() const override;
|
||||
|
||||
std::unique_ptr<FileBackend> OpenFile(const Path& path, const Mode mode) const override;
|
||||
bool DeleteFile(const Path& path) const override;
|
||||
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;
|
||||
ResultCode CreateFile(const Path& path, u64 size) const override;
|
||||
|
@ -309,10 +309,7 @@ ResultCode DeleteFileFromArchive(ArchiveHandle archive_handle, const FileSys::Pa
|
||||
if (archive == nullptr)
|
||||
return ERR_INVALID_HANDLE;
|
||||
|
||||
if (archive->DeleteFile(path))
|
||||
return RESULT_SUCCESS;
|
||||
return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description
|
||||
ErrorSummary::Canceled, ErrorLevel::Status);
|
||||
return archive->DeleteFile(path);
|
||||
}
|
||||
|
||||
ResultCode RenameFileBetweenArchives(ArchiveHandle src_archive_handle, const FileSys::Path& src_path,
|
||||
|
Loading…
Reference in New Issue
Block a user