diff options
author | bunnei <bunneidev@gmail.com> | 2014-11-24 02:02:23 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2014-11-24 02:02:23 +0100 |
commit | ef1b16a7eb3da11d18e68521ddd996e8f48f3aa1 (patch) | |
tree | 5562cdcd5eaa63021832dab60abfbb2756533838 /src/core/hle/kernel | |
parent | Merge pull request #220 from yuriks/patch-1 (diff) | |
parent | Added DeleteFile and DeleteDirectory functions to FS:USER and the archives. (diff) | |
download | yuzu-ef1b16a7eb3da11d18e68521ddd996e8f48f3aa1.tar yuzu-ef1b16a7eb3da11d18e68521ddd996e8f48f3aa1.tar.gz yuzu-ef1b16a7eb3da11d18e68521ddd996e8f48f3aa1.tar.bz2 yuzu-ef1b16a7eb3da11d18e68521ddd996e8f48f3aa1.tar.lz yuzu-ef1b16a7eb3da11d18e68521ddd996e8f48f3aa1.tar.xz yuzu-ef1b16a7eb3da11d18e68521ddd996e8f48f3aa1.tar.zst yuzu-ef1b16a7eb3da11d18e68521ddd996e8f48f3aa1.zip |
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r-- | src/core/hle/kernel/archive.cpp | 32 | ||||
-rw-r--r-- | src/core/hle/kernel/archive.h | 16 |
2 files changed, 47 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 } /** + * Delete a File from an Archive + * @param archive_handle Handle to an open Archive object + * @param path Path to the File inside of the Archive + * @return Whether deletion succeeded + */ +Result DeleteFileFromArchive(Handle archive_handle, const FileSys::Path& path) { + Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle); + if (archive == nullptr) + return -1; + if (archive->backend->DeleteFile(path)) + return 0; + 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 + * @return Whether deletion succeeded + */ +Result DeleteDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path) { + Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle); + if (archive == nullptr) + return -1; + if (archive->backend->DeleteDirectory(path)) + return 0; + return -1; +} + +/** * Create a Directory from an Archive * @param archive_handle Handle to an open Archive object * @param path Path to the Directory inside of the Archive - * @return Opened Directory object + * @return Whether creation succeeded */ Result CreateDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path) { Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle); diff --git a/src/core/hle/kernel/archive.h b/src/core/hle/kernel/archive.h index 9c6015506..95b3c6656 100644 --- a/src/core/hle/kernel/archive.h +++ b/src/core/hle/kernel/archive.h @@ -46,6 +46,22 @@ Handle CreateArchive(FileSys::Archive* backend, const std::string& name); Handle OpenFileFromArchive(Handle archive_handle, const FileSys::Path& path, const FileSys::Mode mode); /** + * Delete a File from an Archive + * @param archive_handle Handle to an open Archive object + * @param path Path to the File inside of the Archive + * @return Whether deletion succeeded + */ +Result DeleteFileFromArchive(Handle archive_handle, const FileSys::Path& 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 + * @return Whether deletion succeeded + */ +Result DeleteDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path); + +/** * Create a Directory from an Archive * @param archive_handle Handle to an open Archive object * @param path Path to the Directory inside of the Archive |