summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/archive.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2014-11-23 20:02:23 -0500
committerGravatar bunnei2014-11-23 20:02:23 -0500
commitef1b16a7eb3da11d18e68521ddd996e8f48f3aa1 (patch)
tree5562cdcd5eaa63021832dab60abfbb2756533838 /src/core/hle/kernel/archive.cpp
parentMerge pull request #220 from yuriks/patch-1 (diff)
parentAdded DeleteFile and DeleteDirectory functions to FS:USER and the archives. (diff)
downloadyuzu-ef1b16a7eb3da11d18e68521ddd996e8f48f3aa1.tar.gz
yuzu-ef1b16a7eb3da11d18e68521ddd996e8f48f3aa1.tar.xz
yuzu-ef1b16a7eb3da11d18e68521ddd996e8f48f3aa1.zip
Merge pull request #191 from archshift/deletexyz
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 d9ee4682a..900f484c7 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);