diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/archive.cpp | 24 | ||||
-rw-r--r-- | src/core/hle/kernel/archive.h | 11 |
2 files changed, 35 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) { } /** + * Rename a File between two Archives + * @param src_archive_handle Handle to the source Archive object + * @param src_path Path to the File inside of the source Archive + * @param dest_archive_handle Handle to the destination Archive object + * @param dest_path Path to the File inside of the destination Archive + * @return Whether rename succeeded + */ +Result RenameFileBetweenArchives(Handle src_archive_handle, const FileSys::Path& src_path, + Handle dest_archive_handle, const FileSys::Path& dest_path) { + Archive* src_archive = Kernel::g_object_pool.GetFast<Archive>(src_archive_handle); + Archive* dest_archive = Kernel::g_object_pool.GetFast<Archive>(dest_archive_handle); + if (src_archive == nullptr || dest_archive == nullptr) + return -1; + if (src_archive == dest_archive) { + if (src_archive->backend->RenameFile(src_path, dest_path)) + return 0; + } else { + // TODO: Implement renaming across archives + return -1; + } + return -1; +} + +/** * Delete a Directory from an Archive * @param archive_handle Handle to an open Archive object * @param path Path to the Directory inside of the Archive diff --git a/src/core/hle/kernel/archive.h b/src/core/hle/kernel/archive.h index 6fc4f0f25..5158fbae8 100644 --- a/src/core/hle/kernel/archive.h +++ b/src/core/hle/kernel/archive.h @@ -53,6 +53,17 @@ ResultVal<Handle> OpenFileFromArchive(Handle archive_handle, const FileSys::Path Result DeleteFileFromArchive(Handle archive_handle, const FileSys::Path& path); /** + * Rename a File between two Archives + * @param src_archive_handle Handle to the source Archive object + * @param src_path Path to the File inside of the source Archive + * @param dest_archive_handle Handle to the destination Archive object + * @param dest_path Path to the File inside of the destination Archive + * @return Whether rename succeeded + */ +Result RenameFileBetweenArchives(Handle src_archive_handle, const FileSys::Path& src_path, + Handle dest_archive_handle, const FileSys::Path& dest_path); + +/** * Delete a Directory from an Archive * @param archive_handle Handle to an open Archive object * @param path Path to the Directory inside of the Archive |