mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
NAMUT_DeleteNandTmpDirectory() を追加
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2261 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
6a3abcf708
commit
17aa454428
@ -251,6 +251,78 @@ BOOL NAMUT_DeleteNandDirectory(const char *path)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: NAMUT_DeleteNandTmpDirectory
|
||||||
|
|
||||||
|
Description: "nand:/tmp" ディレクトリ以下を消去します。
|
||||||
|
例外として、"nand:/tmp/es" 以下を残します。
|
||||||
|
|
||||||
|
Arguments: None
|
||||||
|
|
||||||
|
Returns: None
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
BOOL NAMUT_DeleteNandTmpDirectory(void)
|
||||||
|
{
|
||||||
|
FSFile dir;
|
||||||
|
FSDirectoryEntryInfo entryInfo;
|
||||||
|
BOOL ret = TRUE;
|
||||||
|
const char* path = "nand:/tmp";
|
||||||
|
|
||||||
|
FS_InitFile(&dir);
|
||||||
|
|
||||||
|
// ディレクトリ "nand:/tmp" を開く
|
||||||
|
if (!FS_OpenDirectory(&dir, path, FS_FILEMODE_R))
|
||||||
|
{
|
||||||
|
OS_TWarning("Fail! FS_OpenDirectory(%s) in %s\n", path, __func__);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ディレクトリの中身を読む
|
||||||
|
while (FS_ReadDirectory(&dir, &entryInfo))
|
||||||
|
{
|
||||||
|
if (STD_CompareString(entryInfo.longname, ".") == 0 ||
|
||||||
|
STD_CompareString(entryInfo.longname, "..") == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// es ディレクトリ以下は例外として残す
|
||||||
|
if (STD_CompareString(entryInfo.longname, "es") == 0 &&
|
||||||
|
(entryInfo.attributes & FS_ATTRIBUTE_IS_DIRECTORY))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
STD_CopyLString( sCurrentFullPath, path, FS_ENTRY_LONGNAME_MAX );
|
||||||
|
STD_ConcatenateLString(sCurrentFullPath, "/", FS_ENTRY_LONGNAME_MAX);
|
||||||
|
STD_ConcatenateLString(sCurrentFullPath, entryInfo.longname, FS_ENTRY_LONGNAME_MAX);
|
||||||
|
|
||||||
|
// ディレクトリ
|
||||||
|
if (entryInfo.attributes & FS_ATTRIBUTE_IS_DIRECTORY)
|
||||||
|
{
|
||||||
|
if (!FS_DeleteDirectoryAuto(sCurrentFullPath))
|
||||||
|
{
|
||||||
|
ret = FALSE;
|
||||||
|
OS_TWarning("Fail! FS_DeleteDirectoryAuto(%s) in %s\n", sCurrentFullPath, __func__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ファイル
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!FS_DeleteFileAuto(sCurrentFullPath))
|
||||||
|
{
|
||||||
|
ret = FALSE;
|
||||||
|
OS_TWarning("Fail! FS_DeleteFileAuto(%s) in %s\n", sCurrentFullPath, __func__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ディレクトリを閉じる
|
||||||
|
FS_CloseDirectory(&dir);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
Name: NAMUTi_DeleteNonprotectedTitle
|
Name: NAMUTi_DeleteNonprotectedTitle
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user