1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html xmlns="http://www.w3.org/1999/xhtml"> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /> 5<meta http-equiv="Content-Style-Type" content="text/css" /> 6<title>FS_*FileAuto,FS_*DirectoryAuto</title> 7<link rel="stylesheet" href="../../css/nitro.css" type="text/css" /> 8</head> 9<body> 10<h1>FS_*FileAuto,FS_*DirectoryAuto <img src="../../image/NTR.gif"align="middle"><img src="../../image/TWL.gif" align="middle"></h1> 11<h2>Syntax</h2> 12 13<pre><code> 14#include <nitro/fs.h> 15 16BOOL FS_CreateFileAuto(const char *path, u32 permit); 17BOOL FS_DeleteFileAuto(const char *path); 18BOOL FS_RenameFileAuto(const char *src, const char *dst); 19BOOL FS_CreateDirectoryAuto(const char *path, u32 permit); 20BOOL FS_DeleteDirectoryAuto(const char *path); 21BOOL FS_RenameDirectoryAuto(const char *src, const char *dst); 22</code></pre> 23<h2>Arguments</h2> 24<p>These are the same as those of the normal functions without the "<CODE>Auto</CODE>" suffix.</p> 25 26<h2>Return Values</h2> 27<p>These are the same as those of the normal functions without the "<CODE>Auto</CODE>" suffix.</p> 28 29<h2>Description</h2> 30<p>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 "<CODE>Auto</CODE>" suffix. The following operations are supplemented as follows with these functions. 31<ul> 32<li>If the creation path for <CODE>Create</CODE> or the destination path for <CODE>Rename</CODE> 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.</li> 33<li>If a directory to be deleted with <CODE>Delete</CODE> is not empty, all items under that directory will be deleted.</li> 34</ul> 35</p> 36 37<h2>Note</h2> 38<ul> 39<li>This function cannot be called from the interrupt handler (IRQ mode). Also note that in some cases processing may not end if interrupts are left prohibited.</li> 40<li style='color:Red'>Because these functions automatically supplement directory operations, it is possible for them to succeed in path operations that would normally fail using the normal functions. Extreme care must be taken regarding their usage. 41<pre style='color:Black;border:solid 1px Black;width:80%'><code> 42Safe Example: 43 <span style='color:#008000'>// Debugging will be more effective if only constant strings are ever used. 44 // We recommend using these "Auto" functions for convenience, in a way that is limited to a single purpose.</span> 45 static const char *dir = "tmp:/workdir/"; 46 FS_DeleteDirectoryAuto(dir); 47 48Dangerous Example: 49 <span style='color:#008000'>// Dynamically generated paths are more inclined to bugs. 50 // In situations that rely on the operating environment, either this kind of usage should be avoided or extreme caution must be exercised.</span> 51 STD_SPrintf(path, "savedata:/users/%s/", newUserName); 52 FS_CreateDirectoryAuto(path); 53 54</code></pre> 55</li> 56<li style='color:Red'>If these functions fail, <code><a href="../archive/FS_GetArchiveResultCode.html">FS_GetArchiveResultCode()</a></code> cannot be used to check the exact error details.</li> 57</ul> 58 59<h2>See Also</h2> 60<p><code><a href="FS_CreateDirectory.html">FS_CreateDirectory</A> <a href="FS_DeleteDirectory.html">FS_DeleteDirectory</A> <a href="FS_RenameDirectory.html">FS_RenameDirectory</A> <a href="FS_CreateFile.html">FS_CreateFile</A> <a href="FS_DeleteFile.html">FS_DeleteFile</A> <a href="FS_RenameFile.html">FS_RenameFile</A></code></p> 61 62<h2>Revision History</h2> 63<p> 642008/01/25 Initial version. 65</p> 66<hr><p>CONFIDENTIAL</p></body> 67</html> 68