summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/archive.cpp
diff options
context:
space:
mode:
authorGravatar archshift2014-11-11 10:37:26 -0800
committerGravatar archshift2014-11-23 00:33:43 -0800
commit8aeadbd95a85e2d42d282897d7d286d645d61f27 (patch)
tree5cc15bf131a6cfb3e6a0834e07ca2d007f612a7e /src/core/hle/kernel/archive.cpp
parentMerge pull request #192 from bunnei/fs-fix-paths (diff)
downloadyuzu-8aeadbd95a85e2d42d282897d7d286d645d61f27.tar.gz
yuzu-8aeadbd95a85e2d42d282897d7d286d645d61f27.tar.xz
yuzu-8aeadbd95a85e2d42d282897d7d286d645d61f27.zip
Added DeleteFile and DeleteDirectory functions to FS:USER and the archives.
Diffstat (limited to 'src/core/hle/kernel/archive.cpp')
-rw-r--r--src/core/hle/kernel/archive.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/core/hle/kernel/archive.cpp b/src/core/hle/kernel/archive.cpp
index 8f1c95d0f..85defeb7a 100644
--- a/src/core/hle/kernel/archive.cpp
+++ b/src/core/hle/kernel/archive.cpp
@@ -392,10 +392,40 @@ Handle OpenFileFromArchive(Handle archive_handle, const FileSys::Path& path, con
392} 392}
393 393
394/** 394/**
395 * Delete a File from an Archive
396 * @param archive_handle Handle to an open Archive object
397 * @param path Path to the File inside of the Archive
398 * @return Whether deletion succeeded
399 */
400Result DeleteFileFromArchive(Handle archive_handle, const FileSys::Path& path) {
401 Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle);
402 if (archive == nullptr)
403 return -1;
404 if (archive->backend->DeleteFile(path))
405 return 0;
406 return -1;
407}
408
409/**
410 * Delete a Directory from an Archive
411 * @param archive_handle Handle to an open Archive object
412 * @param path Path to the Directory inside of the Archive
413 * @return Whether deletion succeeded
414 */
415Result DeleteDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path) {
416 Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle);
417 if (archive == nullptr)
418 return -1;
419 if (archive->backend->DeleteDirectory(path))
420 return 0;
421 return -1;
422}
423
424/**
395 * Create a Directory from an Archive 425 * Create a Directory from an Archive
396 * @param archive_handle Handle to an open Archive object 426 * @param archive_handle Handle to an open Archive object
397 * @param path Path to the Directory inside of the Archive 427 * @param path Path to the Directory inside of the Archive
398 * @return Opened Directory object 428 * @return Whether creation succeeded
399 */ 429 */
400Result CreateDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path) { 430Result CreateDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path) {
401 Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle); 431 Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle);