diff options
| author | 2014-11-23 23:20:04 -0800 | |
|---|---|---|
| committer | 2014-11-24 15:09:11 -0800 | |
| commit | 45afc15aa6b9b1798a321bc053171deb765d7681 (patch) | |
| tree | 54da02809c463f89462c3b29a48fb1564f699f01 /src/core/hle/kernel/archive.cpp | |
| parent | Merge pull request #147 from yuriks/error-codes (diff) | |
| download | yuzu-45afc15aa6b9b1798a321bc053171deb765d7681.tar.gz yuzu-45afc15aa6b9b1798a321bc053171deb765d7681.tar.xz yuzu-45afc15aa6b9b1798a321bc053171deb765d7681.zip | |
Implemented RenameFile in FS:USER
Diffstat (limited to 'src/core/hle/kernel/archive.cpp')
| -rw-r--r-- | src/core/hle/kernel/archive.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/core/hle/kernel/archive.cpp b/src/core/hle/kernel/archive.cpp index e273444c9..0bf31ea2f 100644 --- a/src/core/hle/kernel/archive.cpp +++ b/src/core/hle/kernel/archive.cpp | |||
| @@ -356,6 +356,30 @@ Result DeleteFileFromArchive(Handle archive_handle, const FileSys::Path& path) { | |||
| 356 | } | 356 | } |
| 357 | 357 | ||
| 358 | /** | 358 | /** |
| 359 | * Rename a File between two Archives | ||
| 360 | * @param src_archive_handle Handle to the source Archive object | ||
| 361 | * @param src_path Path to the File inside of the source Archive | ||
| 362 | * @param dest_archive_handle Handle to the destination Archive object | ||
| 363 | * @param dest_path Path to the File inside of the destination Archive | ||
| 364 | * @return Whether rename succeeded | ||
| 365 | */ | ||
| 366 | Result RenameFileBetweenArchives(Handle src_archive_handle, const FileSys::Path& src_path, | ||
| 367 | Handle dest_archive_handle, const FileSys::Path& dest_path) { | ||
| 368 | Archive* src_archive = Kernel::g_object_pool.GetFast<Archive>(src_archive_handle); | ||
| 369 | Archive* dest_archive = Kernel::g_object_pool.GetFast<Archive>(dest_archive_handle); | ||
| 370 | if (src_archive == nullptr || dest_archive == nullptr) | ||
| 371 | return -1; | ||
| 372 | if (src_archive == dest_archive) { | ||
| 373 | if (src_archive->backend->RenameFile(src_path, dest_path)) | ||
| 374 | return 0; | ||
| 375 | } else { | ||
| 376 | // TODO: Implement renaming across archives | ||
| 377 | return -1; | ||
| 378 | } | ||
| 379 | return -1; | ||
| 380 | } | ||
| 381 | |||
| 382 | /** | ||
| 359 | * Delete a Directory from an Archive | 383 | * Delete a Directory from an Archive |
| 360 | * @param archive_handle Handle to an open Archive object | 384 | * @param archive_handle Handle to an open Archive object |
| 361 | * @param path Path to the Directory inside of the Archive | 385 | * @param path Path to the Directory inside of the Archive |