summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/fs
diff options
context:
space:
mode:
authorwwylele <wwylele@gmail.com>2016-10-02 05:29:04 +0200
committerwwylele <wwylele@gmail.com>2016-10-02 05:29:16 +0200
commit96b0e9476bdd010051bec427d365b49437801f4d (patch)
tree6a80eef8c0fbbf7e891755a102fcc8674efb1f26 /src/core/hle/service/fs
parentMerge pull request #2083 from yuriks/opengl-scissor-cached-rect (diff)
downloadyuzu-96b0e9476bdd010051bec427d365b49437801f4d.tar
yuzu-96b0e9476bdd010051bec427d365b49437801f4d.tar.gz
yuzu-96b0e9476bdd010051bec427d365b49437801f4d.tar.bz2
yuzu-96b0e9476bdd010051bec427d365b49437801f4d.tar.lz
yuzu-96b0e9476bdd010051bec427d365b49437801f4d.tar.xz
yuzu-96b0e9476bdd010051bec427d365b49437801f4d.tar.zst
yuzu-96b0e9476bdd010051bec427d365b49437801f4d.zip
Diffstat (limited to 'src/core/hle/service/fs')
-rw-r--r--src/core/hle/service/fs/archive.cpp12
-rw-r--r--src/core/hle/service/fs/archive.h9
-rw-r--r--src/core/hle/service/fs/fs_user.cpp31
3 files changed, 51 insertions, 1 deletions
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 4dc7e1e3c..7f9696bfb 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -362,6 +362,18 @@ ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSy
ErrorSummary::Canceled, ErrorLevel::Status);
}
+ResultCode DeleteDirectoryRecursivelyFromArchive(ArchiveHandle archive_handle,
+ const FileSys::Path& path) {
+ ArchiveBackend* archive = GetArchive(archive_handle);
+ if (archive == nullptr)
+ return ERR_INVALID_ARCHIVE_HANDLE;
+
+ if (archive->DeleteDirectoryRecursively(path))
+ return RESULT_SUCCESS;
+ return ResultCode(ErrorDescription::NoData, ErrorModule::FS, // TODO: verify description
+ ErrorSummary::Canceled, ErrorLevel::Status);
+}
+
ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path,
u64 file_size) {
ArchiveBackend* archive = GetArchive(archive_handle);
diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h
index 533be34a4..41a76285c 100644
--- a/src/core/hle/service/fs/archive.h
+++ b/src/core/hle/service/fs/archive.h
@@ -133,6 +133,15 @@ ResultCode RenameFileBetweenArchives(ArchiveHandle src_archive_handle,
ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSys::Path& path);
/**
+ * Delete a Directory and anything under it 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
+ */
+ResultCode DeleteDirectoryRecursivelyFromArchive(ArchiveHandle archive_handle,
+ const FileSys::Path& path);
+
+/**
* Create a File in an Archive
* @param archive_handle Handle to an open Archive object
* @param path Path to the File inside of the Archive
diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp
index 94f053dc2..582591e40 100644
--- a/src/core/hle/service/fs/fs_user.cpp
+++ b/src/core/hle/service/fs/fs_user.cpp
@@ -235,6 +235,35 @@ static void DeleteDirectory(Service::Interface* self) {
}
/*
+ * FS_User::DeleteDirectoryRecursively service function
+ * Inputs:
+ * 0 : Command header 0x08070142
+ * 1 : Transaction
+ * 2 : Archive handle lower word
+ * 3 : Archive handle upper word
+ * 4 : Directory path string type
+ * 5 : Directory path string size
+ * 7 : Directory path string data
+ * Outputs:
+ * 1 : Result of function, 0 on success, otherwise error code
+ */
+static void DeleteDirectoryRecursively(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
+ auto dirname_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
+ u32 dirname_size = cmd_buff[5];
+ u32 dirname_ptr = cmd_buff[7];
+
+ FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr);
+
+ LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size,
+ dir_path.DebugStr().c_str());
+
+ cmd_buff[1] = DeleteDirectoryRecursivelyFromArchive(archive_handle, dir_path).raw;
+}
+
+/*
* FS_User::CreateFile service function
* Inputs:
* 0 : Command header 0x08080202
@@ -868,7 +897,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x08040142, DeleteFile, "DeleteFile"},
{0x08050244, RenameFile, "RenameFile"},
{0x08060142, DeleteDirectory, "DeleteDirectory"},
- {0x08070142, nullptr, "DeleteDirectoryRecursively"},
+ {0x08070142, DeleteDirectoryRecursively, "DeleteDirectoryRecursively"},
{0x08080202, CreateFile, "CreateFile"},
{0x08090182, CreateDirectory, "CreateDirectory"},
{0x080A0244, RenameDirectory, "RenameDirectory"},