mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-22 13:02:38 +02:00
Add fsFsCleanDirectoryRecursively
This commit is contained in:
parent
aa3c35e6e3
commit
2bcede91ba
@ -181,6 +181,7 @@ Result fsFsOpenDirectory(FsFileSystem* fs, const char* path, int flags, FsDir* o
|
|||||||
Result fsFsCommit(FsFileSystem* fs);
|
Result fsFsCommit(FsFileSystem* fs);
|
||||||
Result fsFsGetFreeSpace(FsFileSystem* fs, const char* path, u64* out);
|
Result fsFsGetFreeSpace(FsFileSystem* fs, const char* path, u64* out);
|
||||||
Result fsFsGetTotalSpace(FsFileSystem* fs, const char* path, u64* out);
|
Result fsFsGetTotalSpace(FsFileSystem* fs, const char* path, u64* out);
|
||||||
|
Result fsFsCleanDirectoryRecursively(FsFileSystem* fs, const char* path);
|
||||||
void fsFsClose(FsFileSystem* fs);
|
void fsFsClose(FsFileSystem* fs);
|
||||||
|
|
||||||
// IFile
|
// IFile
|
||||||
|
@ -842,6 +842,38 @@ Result fsFsGetTotalSpace(FsFileSystem* fs, const char* path, u64* out) {
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result fsFsCleanDirectoryRecursively(FsFileSystem* fs, const char* path) {
|
||||||
|
IpcCommand c;
|
||||||
|
ipcInitialize(&c);
|
||||||
|
ipcAddSendStatic(&c, path, FS_MAX_PATH, 0);
|
||||||
|
|
||||||
|
struct {
|
||||||
|
u64 magic;
|
||||||
|
u64 cmd_id;
|
||||||
|
} *raw;
|
||||||
|
|
||||||
|
raw = ipcPrepareHeader(&c, sizeof(*raw));
|
||||||
|
|
||||||
|
raw->magic = SFCI_MAGIC;
|
||||||
|
raw->cmd_id = 13;
|
||||||
|
|
||||||
|
Result rc = serviceIpcDispatch(&fs->s);
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc)) {
|
||||||
|
IpcParsedCommand r;
|
||||||
|
ipcParse(&r);
|
||||||
|
|
||||||
|
struct {
|
||||||
|
u64 magic;
|
||||||
|
u64 result;
|
||||||
|
} *resp = r.Raw;
|
||||||
|
|
||||||
|
rc = resp->result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
void fsFsClose(FsFileSystem* fs) {
|
void fsFsClose(FsFileSystem* fs) {
|
||||||
serviceClose(&fs->s);
|
serviceClose(&fs->s);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user