diff options
author | wwylele <wwylele@gmail.com> | 2016-10-14 09:29:09 +0200 |
---|---|---|
committer | wwylele <wwylele@gmail.com> | 2016-11-01 17:30:32 +0100 |
commit | 4dd8a831bd5ea32108db837754289ab42a2fa6ca (patch) | |
tree | 0aaf5cc1c8966446c4aa5d4e79d02641b7e4ba30 /src/core/hle/service/fs | |
parent | Merge pull request #2147 from Pringo/readme-donate (diff) | |
download | yuzu-4dd8a831bd5ea32108db837754289ab42a2fa6ca.tar yuzu-4dd8a831bd5ea32108db837754289ab42a2fa6ca.tar.gz yuzu-4dd8a831bd5ea32108db837754289ab42a2fa6ca.tar.bz2 yuzu-4dd8a831bd5ea32108db837754289ab42a2fa6ca.tar.lz yuzu-4dd8a831bd5ea32108db837754289ab42a2fa6ca.tar.xz yuzu-4dd8a831bd5ea32108db837754289ab42a2fa6ca.tar.zst yuzu-4dd8a831bd5ea32108db837754289ab42a2fa6ca.zip |
Diffstat (limited to 'src/core/hle/service/fs')
-rw-r--r-- | src/core/hle/service/fs/archive.cpp | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 7f9696bfb..891d7bc84 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -338,17 +338,11 @@ ResultCode RenameFileBetweenArchives(ArchiveHandle src_archive_handle, return ERR_INVALID_ARCHIVE_HANDLE; if (src_archive == dest_archive) { - if (src_archive->RenameFile(src_path, dest_path)) - return RESULT_SUCCESS; + return src_archive->RenameFile(src_path, dest_path); } else { // TODO: Implement renaming across archives return UnimplementedFunction(ErrorModule::FS); } - - // TODO(yuriks): This code probably isn't right, it'll return a Status even if the file didn't - // exist or similar. Verify. - return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description - ErrorSummary::NothingHappened, ErrorLevel::Status); } ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path) { @@ -356,10 +350,7 @@ ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSy if (archive == nullptr) return ERR_INVALID_ARCHIVE_HANDLE; - if (archive->DeleteDirectory(path)) - return RESULT_SUCCESS; - return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description - ErrorSummary::Canceled, ErrorLevel::Status); + return archive->DeleteDirectory(path); } ResultCode DeleteDirectoryRecursivelyFromArchive(ArchiveHandle archive_handle, @@ -368,10 +359,7 @@ ResultCode DeleteDirectoryRecursivelyFromArchive(ArchiveHandle archive_handle, if (archive == nullptr) return ERR_INVALID_ARCHIVE_HANDLE; - if (archive->DeleteDirectoryRecursively(path)) - return RESULT_SUCCESS; - return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description - ErrorSummary::Canceled, ErrorLevel::Status); + return archive->DeleteDirectoryRecursively(path); } ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path, @@ -388,10 +376,7 @@ ResultCode CreateDirectoryFromArchive(ArchiveHandle archive_handle, const FileSy if (archive == nullptr) return ERR_INVALID_ARCHIVE_HANDLE; - if (archive->CreateDirectory(path)) - return RESULT_SUCCESS; - return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description - ErrorSummary::Canceled, ErrorLevel::Status); + return archive->CreateDirectory(path); } ResultCode RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle, @@ -404,17 +389,11 @@ ResultCode RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle, return ERR_INVALID_ARCHIVE_HANDLE; if (src_archive == dest_archive) { - if (src_archive->RenameDirectory(src_path, dest_path)) - return RESULT_SUCCESS; + return src_archive->RenameDirectory(src_path, dest_path); } else { // TODO: Implement renaming across archives return UnimplementedFunction(ErrorModule::FS); } - - // TODO(yuriks): This code probably isn't right, it'll return a Status even if the file didn't - // exist or similar. Verify. - return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description - ErrorSummary::NothingHappened, ErrorLevel::Status); } ResultVal<Kernel::SharedPtr<Directory>> OpenDirectoryFromArchive(ArchiveHandle archive_handle, @@ -423,13 +402,11 @@ ResultVal<Kernel::SharedPtr<Directory>> OpenDirectoryFromArchive(ArchiveHandle a if (archive == nullptr) return ERR_INVALID_ARCHIVE_HANDLE; - std::unique_ptr<FileSys::DirectoryBackend> backend = archive->OpenDirectory(path); - if (backend == nullptr) { - return ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS, ErrorSummary::NotFound, - ErrorLevel::Permanent); - } + auto backend = archive->OpenDirectory(path); + if (backend.Failed()) + return backend.Code(); - auto directory = Kernel::SharedPtr<Directory>(new Directory(std::move(backend), path)); + auto directory = Kernel::SharedPtr<Directory>(new Directory(backend.MoveFrom(), path)); return MakeResult<Kernel::SharedPtr<Directory>>(std::move(directory)); } |