From 4dd8a831bd5ea32108db837754289ab42a2fa6ca Mon Sep 17 00:00:00 2001 From: wwylele Date: Fri, 14 Oct 2016 15:29:09 +0800 Subject: FileSys: make Archive interfaces return error code and make the mode parameter a reference since it is a BitField union --- src/core/file_sys/ivfc_archive.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'src/core/file_sys/ivfc_archive.cpp') diff --git a/src/core/file_sys/ivfc_archive.cpp b/src/core/file_sys/ivfc_archive.cpp index af59d296d..2735d2e3c 100644 --- a/src/core/file_sys/ivfc_archive.cpp +++ b/src/core/file_sys/ivfc_archive.cpp @@ -18,7 +18,7 @@ std::string IVFCArchive::GetName() const { } ResultVal> IVFCArchive::OpenFile(const Path& path, - const Mode mode) const { + const Mode& mode) const { return MakeResult>( std::make_unique(romfs_file, data_offset, data_size)); } @@ -31,22 +31,25 @@ ResultCode IVFCArchive::DeleteFile(const Path& path) const { ErrorLevel::Status); } -bool IVFCArchive::RenameFile(const Path& src_path, const Path& dest_path) const { +ResultCode IVFCArchive::RenameFile(const Path& src_path, const Path& dest_path) const { LOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive (%s).", GetName().c_str()); - return false; + // TODO(wwylele): Use correct error code + return ResultCode(-1); } -bool IVFCArchive::DeleteDirectory(const Path& path) const { +ResultCode IVFCArchive::DeleteDirectory(const Path& path) const { LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an IVFC archive (%s).", GetName().c_str()); - return false; + // TODO(wwylele): Use correct error code + return ResultCode(-1); } -bool IVFCArchive::DeleteDirectoryRecursively(const Path& path) const { +ResultCode 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; + // TODO(wwylele): Use correct error code + return ResultCode(-1); } ResultCode IVFCArchive::CreateFile(const Path& path, u64 size) const { @@ -57,20 +60,22 @@ ResultCode IVFCArchive::CreateFile(const Path& path, u64 size) const { ErrorLevel::Permanent); } -bool IVFCArchive::CreateDirectory(const Path& path) const { +ResultCode IVFCArchive::CreateDirectory(const Path& path) const { LOG_CRITICAL(Service_FS, "Attempted to create a directory in an IVFC archive (%s).", GetName().c_str()); - return false; + // TODO(wwylele): Use correct error code + return ResultCode(-1); } -bool IVFCArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const { +ResultCode IVFCArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const { LOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive (%s).", GetName().c_str()); - return false; + // TODO(wwylele): Use correct error code + return ResultCode(-1); } -std::unique_ptr IVFCArchive::OpenDirectory(const Path& path) const { - return std::make_unique(); +ResultVal> IVFCArchive::OpenDirectory(const Path& path) const { + return MakeResult>(std::make_unique()); } u64 IVFCArchive::GetFreeBytes() const { -- cgit v1.2.3