mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-28 20:55:29 +03:00
Implement VFS file deletion
This commit is contained in:
parent
6c968e0357
commit
2ce2604421
@ -53,6 +53,13 @@ namespace skyline::service::fssrv {
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IFileSystem::DeleteFile(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
std::string path(request.inputBuf.at(0).as_string(true));
|
||||
|
||||
backing->DeleteFile(path);
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IFileSystem::OpenDirectory(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
std::string path(request.inputBuf.at(0).as_string(true));
|
||||
|
||||
|
@ -23,6 +23,11 @@ namespace skyline::service::fssrv {
|
||||
*/
|
||||
Result CreateFile(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief Deletes a file at the specified path in the filesystem
|
||||
*/
|
||||
Result DeleteFile(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief Creates a directory at the specified path in the filesystem
|
||||
*/
|
||||
@ -53,6 +58,7 @@ namespace skyline::service::fssrv {
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IFileSystem, CreateFile),
|
||||
SFUNC(0x1, IFileSystem, DeleteFile),
|
||||
SFUNC(0x2, IFileSystem, CreateDirectory),
|
||||
SFUNC(0x7, IFileSystem, GetEntryType),
|
||||
SFUNC(0x8, IFileSystem, OpenFile),
|
||||
|
@ -16,6 +16,10 @@ namespace skyline::vfs {
|
||||
throw exception("This filesystem does not support creating files");
|
||||
};
|
||||
|
||||
virtual void DeleteFileImpl(const std::string &path) {
|
||||
throw exception("This filesystem does not support deleting files");
|
||||
}
|
||||
|
||||
virtual bool CreateDirectoryImpl(const std::string &path, bool parents) {
|
||||
throw exception("This filesystem does not support creating directories");
|
||||
};
|
||||
@ -46,7 +50,11 @@ namespace skyline::vfs {
|
||||
*/
|
||||
bool CreateFile(const std::string &path, size_t size) {
|
||||
return CreateFileImpl(path, size);
|
||||
};
|
||||
}
|
||||
|
||||
void DeleteFile(const std::string &path) {
|
||||
DeleteFileImpl(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a directory in the filesystem
|
||||
|
@ -38,6 +38,11 @@ namespace skyline::vfs {
|
||||
return true;
|
||||
}
|
||||
|
||||
void OsFileSystem::DeleteFileImpl(const std::string &path) {
|
||||
auto fullPath{basePath + path};
|
||||
remove(fullPath.c_str());
|
||||
}
|
||||
|
||||
bool OsFileSystem::CreateDirectoryImpl(const std::string &path, bool parents) {
|
||||
auto fullPath{basePath + path + "/"};
|
||||
|
||||
|
@ -16,6 +16,8 @@ namespace skyline::vfs {
|
||||
protected:
|
||||
bool CreateFileImpl(const std::string &path, size_t size) override;
|
||||
|
||||
void DeleteFileImpl(const std::string &path) override;
|
||||
|
||||
bool CreateDirectoryImpl(const std::string &path, bool parents) override;
|
||||
|
||||
std::shared_ptr<Backing> OpenFileImpl(const std::string &path, Backing::Mode mode) override;
|
||||
|
Loading…
Reference in New Issue
Block a user