Implement IFileSystem::CreateDirectory

This commit is contained in:
Billy Laws 2022-06-02 00:02:43 +01:00
parent a09414424b
commit 33c9731eca
2 changed files with 13 additions and 1 deletions

View File

@ -10,13 +10,19 @@ namespace skyline::service::fssrv {
IFileSystem::IFileSystem(std::shared_ptr<vfs::FileSystem> backing, const DeviceState &state, ServiceManager &manager) : backing(std::move(backing)), BaseService(state, manager) {}
Result IFileSystem::CreateFile(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
std::string path(request.inputBuf.at(0).as_string(true));
std::string path{request.inputBuf.at(0).as_string(true)};
auto mode{request.Pop<u64>()};
auto size{request.Pop<u32>()};
return backing->CreateFile(path, size) ? Result{} : result::PathDoesNotExist;
}
Result IFileSystem::CreateDirectory(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
std::string path{request.inputBuf.at(0).as_string(true)};
return backing->CreateDirectory(path, true) ? Result{} : result::PathDoesNotExist;
}
Result IFileSystem::GetEntryType(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
std::string path(request.inputBuf.at(0).as_string(true));

View File

@ -23,6 +23,11 @@ namespace skyline::service::fssrv {
*/
Result CreateFile(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
/**
* @brief Creates a directory at the specified path in the filesystem
*/
Result CreateDirectory(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
/**
* @brief Queries the DirectoryEntryType of the given path
* @url https://switchbrew.org/wiki/Filesystem_services#GetEntryType
@ -48,6 +53,7 @@ namespace skyline::service::fssrv {
SERVICE_DECL(
SFUNC(0x0, IFileSystem, CreateFile),
SFUNC(0x2, IFileSystem, CreateDirectory),
SFUNC(0x7, IFileSystem, GetEntryType),
SFUNC(0x8, IFileSystem, OpenFile),
SFUNC(0x9, IFileSystem, OpenDirectory),