diff options
| author | 2016-10-14 15:29:09 +0800 | |
|---|---|---|
| committer | 2016-11-01 18:30:32 +0200 | |
| commit | 4dd8a831bd5ea32108db837754289ab42a2fa6ca (patch) | |
| tree | 0aaf5cc1c8966446c4aa5d4e79d02641b7e4ba30 /src/core/hle | |
| parent | Merge pull request #2147 from Pringo/readme-donate (diff) | |
| download | yuzu-4dd8a831bd5ea32108db837754289ab42a2fa6ca.tar.gz yuzu-4dd8a831bd5ea32108db837754289ab42a2fa6ca.tar.xz yuzu-4dd8a831bd5ea32108db837754289ab42a2fa6ca.zip | |
FileSys: make Archive interfaces return error code
and make the mode parameter a reference since it is a BitField union
Diffstat (limited to 'src/core/hle')
| -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, | |||
| 338 | return ERR_INVALID_ARCHIVE_HANDLE; | 338 | return ERR_INVALID_ARCHIVE_HANDLE; |
| 339 | 339 | ||
| 340 | if (src_archive == dest_archive) { | 340 | if (src_archive == dest_archive) { |
| 341 | if (src_archive->RenameFile(src_path, dest_path)) | 341 | return src_archive->RenameFile(src_path, dest_path); |
| 342 | return RESULT_SUCCESS; | ||
| 343 | } else { | 342 | } else { |
| 344 | // TODO: Implement renaming across archives | 343 | // TODO: Implement renaming across archives |
| 345 | return UnimplementedFunction(ErrorModule::FS); | 344 | return UnimplementedFunction(ErrorModule::FS); |
| 346 | } | 345 | } |
| 347 | |||
| 348 | // TODO(yuriks): This code probably isn't right, it'll return a Status even if the file didn't | ||
| 349 | // exist or similar. Verify. | ||
| 350 | return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description | ||
| 351 | ErrorSummary::NothingHappened, ErrorLevel::Status); | ||
| 352 | } | 346 | } |
| 353 | 347 | ||
| 354 | ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path) { | 348 | ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path) { |
| @@ -356,10 +350,7 @@ ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSy | |||
| 356 | if (archive == nullptr) | 350 | if (archive == nullptr) |
| 357 | return ERR_INVALID_ARCHIVE_HANDLE; | 351 | return ERR_INVALID_ARCHIVE_HANDLE; |
| 358 | 352 | ||
| 359 | if (archive->DeleteDirectory(path)) | 353 | return archive->DeleteDirectory(path); |
| 360 | return RESULT_SUCCESS; | ||
| 361 | return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description | ||
| 362 | ErrorSummary::Canceled, ErrorLevel::Status); | ||
| 363 | } | 354 | } |
| 364 | 355 | ||
| 365 | ResultCode DeleteDirectoryRecursivelyFromArchive(ArchiveHandle archive_handle, | 356 | ResultCode DeleteDirectoryRecursivelyFromArchive(ArchiveHandle archive_handle, |
| @@ -368,10 +359,7 @@ ResultCode DeleteDirectoryRecursivelyFromArchive(ArchiveHandle archive_handle, | |||
| 368 | if (archive == nullptr) | 359 | if (archive == nullptr) |
| 369 | return ERR_INVALID_ARCHIVE_HANDLE; | 360 | return ERR_INVALID_ARCHIVE_HANDLE; |
| 370 | 361 | ||
| 371 | if (archive->DeleteDirectoryRecursively(path)) | 362 | return archive->DeleteDirectoryRecursively(path); |
| 372 | return RESULT_SUCCESS; | ||
| 373 | return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description | ||
| 374 | ErrorSummary::Canceled, ErrorLevel::Status); | ||
| 375 | } | 363 | } |
| 376 | 364 | ||
| 377 | ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path, | 365 | ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path, |
| @@ -388,10 +376,7 @@ ResultCode CreateDirectoryFromArchive(ArchiveHandle archive_handle, const FileSy | |||
| 388 | if (archive == nullptr) | 376 | if (archive == nullptr) |
| 389 | return ERR_INVALID_ARCHIVE_HANDLE; | 377 | return ERR_INVALID_ARCHIVE_HANDLE; |
| 390 | 378 | ||
| 391 | if (archive->CreateDirectory(path)) | 379 | return archive->CreateDirectory(path); |
| 392 | return RESULT_SUCCESS; | ||
| 393 | return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description | ||
| 394 | ErrorSummary::Canceled, ErrorLevel::Status); | ||
| 395 | } | 380 | } |
| 396 | 381 | ||
| 397 | ResultCode RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle, | 382 | ResultCode RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle, |
| @@ -404,17 +389,11 @@ ResultCode RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle, | |||
| 404 | return ERR_INVALID_ARCHIVE_HANDLE; | 389 | return ERR_INVALID_ARCHIVE_HANDLE; |
| 405 | 390 | ||
| 406 | if (src_archive == dest_archive) { | 391 | if (src_archive == dest_archive) { |
| 407 | if (src_archive->RenameDirectory(src_path, dest_path)) | 392 | return src_archive->RenameDirectory(src_path, dest_path); |
| 408 | return RESULT_SUCCESS; | ||
| 409 | } else { | 393 | } else { |
| 410 | // TODO: Implement renaming across archives | 394 | // TODO: Implement renaming across archives |
| 411 | return UnimplementedFunction(ErrorModule::FS); | 395 | return UnimplementedFunction(ErrorModule::FS); |
| 412 | } | 396 | } |
| 413 | |||
| 414 | // TODO(yuriks): This code probably isn't right, it'll return a Status even if the file didn't | ||
| 415 | // exist or similar. Verify. | ||
| 416 | return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description | ||
| 417 | ErrorSummary::NothingHappened, ErrorLevel::Status); | ||
| 418 | } | 397 | } |
| 419 | 398 | ||
| 420 | ResultVal<Kernel::SharedPtr<Directory>> OpenDirectoryFromArchive(ArchiveHandle archive_handle, | 399 | ResultVal<Kernel::SharedPtr<Directory>> OpenDirectoryFromArchive(ArchiveHandle archive_handle, |
| @@ -423,13 +402,11 @@ ResultVal<Kernel::SharedPtr<Directory>> OpenDirectoryFromArchive(ArchiveHandle a | |||
| 423 | if (archive == nullptr) | 402 | if (archive == nullptr) |
| 424 | return ERR_INVALID_ARCHIVE_HANDLE; | 403 | return ERR_INVALID_ARCHIVE_HANDLE; |
| 425 | 404 | ||
| 426 | std::unique_ptr<FileSys::DirectoryBackend> backend = archive->OpenDirectory(path); | 405 | auto backend = archive->OpenDirectory(path); |
| 427 | if (backend == nullptr) { | 406 | if (backend.Failed()) |
| 428 | return ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS, ErrorSummary::NotFound, | 407 | return backend.Code(); |
| 429 | ErrorLevel::Permanent); | ||
| 430 | } | ||
| 431 | 408 | ||
| 432 | auto directory = Kernel::SharedPtr<Directory>(new Directory(std::move(backend), path)); | 409 | auto directory = Kernel::SharedPtr<Directory>(new Directory(backend.MoveFrom(), path)); |
| 433 | return MakeResult<Kernel::SharedPtr<Directory>>(std::move(directory)); | 410 | return MakeResult<Kernel::SharedPtr<Directory>>(std::move(directory)); |
| 434 | } | 411 | } |
| 435 | 412 | ||