#include <nitro/fs.h>
BOOL FS_CreateFileAuto(const char *path, u32 permit);
BOOL FS_DeleteFileAuto(const char *path);
BOOL FS_RenameFileAuto(const char *src, const char *dst);
BOOL FS_CreateDirectoryAuto(const char *path, u32 permit);
BOOL FS_DeleteDirectoryAuto(const char *path);
BOOL FS_RenameDirectoryAuto(const char *src, const char *dst);
These are the same as those of the normal functions without the "Auto
" suffix.
These are the same as those of the normal functions without the "Auto
" suffix.
Except for the fact that the directory operations performed on the target path will be automatically supplemented, these are the same as the normal functions without the "Auto
" suffix. The following operations are supplemented as follows with these functions.
Create
or the destination path for Rename
are under a directory that does not exist, all subdirectories leading to these paths will be created automatically. If the intended process fails, the directories that were created automatically will be deleted.Delete
is not empty, all items under that directory will be deleted.
Safe Example:
// Debugging will be more effective if only constant strings are ever used.
// We recommend using these "Auto" functions for convenience, in a way that is limited to a single purpose.
static const char *dir = "tmp:/workdir/";
FS_DeleteDirectoryAuto(dir);
Dangerous Example:
// Dynamically generated paths are more inclined to bugs.
// In situations that rely on the operating environment, either this kind of usage should be avoided or extreme caution must be exercised.
STD_SPrintf(path, "savedata:/users/%s/", newUserName);
FS_CreateDirectoryAuto(path);
FS_GetArchiveResultCode()
cannot be used to check the exact error details.FS_CreateDirectory FS_DeleteDirectory FS_RenameDirectory FS_CreateFile FS_DeleteFile FS_RenameFile
2008/01/25 Initial version.
CONFIDENTIAL