diff options
| author | bunnei <bunneidev@gmail.com> | 2018-04-15 15:13:02 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-04-15 15:13:02 -0400 |
| commit | b8825fbf10c3122309313a959a93b20baa94ec2f (patch) | |
| tree | c7e6223749099a7ae145cb1a925d6a71c16c169a /src/core/hle/service/filesystem | |
| parent | b60834ac41ea3fcff26cf19cd08f2dbe3f3bda58 (diff) | |
| parent | bddad50dd400b31849fbd9486637fa9a2522cf58 (diff) | |
Merge pull request #335 from bunnei/delete-file
fsp_srv: Implement DeleteFile.
Diffstat (limited to 'src/core/hle/service/filesystem')
| -rw-r--r-- | src/core/hle/service/filesystem/fsp_srv.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 458210a55..45accbf0e 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -236,7 +236,7 @@ public: : ServiceFramework("IFileSystem"), backend(std::move(backend)) { static const FunctionInfo functions[] = { {0, &IFileSystem::CreateFile, "CreateFile"}, - {1, nullptr, "DeleteFile"}, + {1, &IFileSystem::DeleteFile, "DeleteFile"}, {2, &IFileSystem::CreateDirectory, "CreateDirectory"}, {3, nullptr, "DeleteDirectory"}, {4, nullptr, "DeleteDirectoryRecursively"}, @@ -273,6 +273,20 @@ public: rb.Push(backend->CreateFile(name, size)); } + void DeleteFile(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + + auto file_buffer = ctx.ReadBuffer(); + auto end = std::find(file_buffer.begin(), file_buffer.end(), '\0'); + + std::string name(file_buffer.begin(), end); + + LOG_DEBUG(Service_FS, "called file %s", name.c_str()); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(backend->DeleteFile(name)); + } + void CreateDirectory(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; |
