mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-26 07:24:15 +01:00
Stub DeleteDirectory
Should allow deleting/rewriting saves in some games
This commit is contained in:
parent
bbd34ae7e7
commit
69ee3cfc66
@ -60,6 +60,13 @@ namespace skyline::service::fssrv {
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IFileSystem::DeleteDirectory(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
std::string path(request.inputBuf.at(0).as_string(true));
|
||||
|
||||
backing->DeleteDirectory(path);
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IFileSystem::OpenDirectory(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
std::string path(request.inputBuf.at(0).as_string(true));
|
||||
|
||||
|
@ -33,6 +33,11 @@ namespace skyline::service::fssrv {
|
||||
*/
|
||||
Result CreateDirectory(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief Deletes a directory at the specified path in the filesystem
|
||||
*/
|
||||
Result DeleteDirectory(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
|
||||
@ -60,6 +65,7 @@ namespace skyline::service::fssrv {
|
||||
SFUNC(0x0, IFileSystem, CreateFile),
|
||||
SFUNC(0x1, IFileSystem, DeleteFile),
|
||||
SFUNC(0x2, IFileSystem, CreateDirectory),
|
||||
SFUNC(0x3, IFileSystem, DeleteDirectory),
|
||||
SFUNC(0x7, IFileSystem, GetEntryType),
|
||||
SFUNC(0x8, IFileSystem, OpenFile),
|
||||
SFUNC(0x9, IFileSystem, OpenDirectory),
|
||||
|
@ -20,6 +20,10 @@ namespace skyline::vfs {
|
||||
throw exception("This filesystem does not support deleting files");
|
||||
}
|
||||
|
||||
virtual void DeleteDirectoryImpl(const std::string &path) {
|
||||
throw exception("This filesystem does not support deleting directories");
|
||||
}
|
||||
|
||||
virtual bool CreateDirectoryImpl(const std::string &path, bool parents) {
|
||||
throw exception("This filesystem does not support creating directories");
|
||||
};
|
||||
@ -56,6 +60,10 @@ namespace skyline::vfs {
|
||||
DeleteFileImpl(path);
|
||||
}
|
||||
|
||||
void DeleteDirectory(const std::string &path) {
|
||||
DeleteDirectoryImpl(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a directory in the filesystem
|
||||
* @param path The path to where the directory should be created
|
||||
|
@ -43,6 +43,11 @@ namespace skyline::vfs {
|
||||
remove(fullPath.c_str());
|
||||
}
|
||||
|
||||
void OsFileSystem::DeleteDirectoryImpl(const std::string &path) {
|
||||
auto fullPath{basePath + path};
|
||||
std::filesystem::remove_all(fullPath.c_str());
|
||||
}
|
||||
|
||||
bool OsFileSystem::CreateDirectoryImpl(const std::string &path, bool parents) {
|
||||
auto fullPath{basePath + path + "/"};
|
||||
|
||||
|
@ -18,6 +18,8 @@ namespace skyline::vfs {
|
||||
|
||||
void DeleteFileImpl(const std::string &path) override;
|
||||
|
||||
void DeleteDirectoryImpl(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