diff --git a/nx/include/switch/runtime/devices/fs_dev.h b/nx/include/switch/runtime/devices/fs_dev.h index 05ab9329..689b8113 100644 --- a/nx/include/switch/runtime/devices/fs_dev.h +++ b/nx/include/switch/runtime/devices/fs_dev.h @@ -48,5 +48,8 @@ int fsdevTranslatePath(const char *path, FsFileSystem** device, char *outpath); /// This calls fsFsSetArchiveBit on the filesystem specified by the input absolute path. Result fsdevSetArchiveBit(const char *path); +/// Recursively deletes the directory specified by the input absolute path. +Result fsdevDeleteDirectoryRecursively(const char *path); + /// Unmounts all devices and cleans up any resources used by the FS driver. Result fsdevUnmountAll(void); diff --git a/nx/source/runtime/devices/fs_dev.c b/nx/source/runtime/devices/fs_dev.c index c581752a..c93ad498 100644 --- a/nx/source/runtime/devices/fs_dev.c +++ b/nx/source/runtime/devices/fs_dev.c @@ -380,6 +380,16 @@ Result fsdevSetArchiveBit(const char *path) { return fsFsSetArchiveBit(&device->fs, fs_path); } +Result fsdevDeleteDirectoryRecursively(const char *path) { + char fs_path[FS_MAX_PATH]; + fsdev_fsdevice *device = NULL; + + if(fsdev_getfspath(_REENT, path, &device, fs_path)==-1) + return MAKERESULT(Module_Libnx, LibnxError_NotFound); + + return fsFsDeleteDirectoryRecursively(&device->fs, fs_path); +} + /*! Initialize SDMC device */ Result fsdevMountSdmc(void) {