2016-07-27 08:28:48 +00:00
|
|
|
#include "fs.h"
|
|
|
|
|
2017-07-15 06:00:34 +00:00
|
|
|
void openArchive(FS_ArchiveID id)
|
2016-07-27 08:28:48 +00:00
|
|
|
{
|
2017-07-15 06:00:34 +00:00
|
|
|
FSUSER_OpenArchive(&fsArchive, id, fsMakePath(PATH_EMPTY, ""));
|
2016-07-27 08:28:48 +00:00
|
|
|
}
|
|
|
|
|
2017-07-15 06:00:34 +00:00
|
|
|
void closeArchive(void)
|
2016-07-27 08:28:48 +00:00
|
|
|
{
|
2017-07-15 06:00:34 +00:00
|
|
|
FSUSER_CloseArchive(fsArchive);
|
2016-07-27 08:28:48 +00:00
|
|
|
}
|
|
|
|
|
2017-07-15 06:00:34 +00:00
|
|
|
Result makeDir(FS_Archive archive, const char * path)
|
2016-07-27 08:28:48 +00:00
|
|
|
{
|
2017-07-15 06:00:34 +00:00
|
|
|
if((!archive) || (!path))
|
2016-07-27 08:28:48 +00:00
|
|
|
return -1;
|
|
|
|
|
2017-07-15 06:00:34 +00:00
|
|
|
return FSUSER_CreateDirectory(archive, fsMakePath(PATH_ASCII, path), 0);
|
2016-07-27 08:28:48 +00:00
|
|
|
}
|
|
|
|
|
2017-07-15 06:00:34 +00:00
|
|
|
bool fileExists(FS_Archive archive, const char * path)
|
2016-07-27 08:28:48 +00:00
|
|
|
{
|
2017-07-15 06:00:34 +00:00
|
|
|
if((!path) || (!archive))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
Handle handle;
|
2016-07-27 08:28:48 +00:00
|
|
|
|
2017-07-15 06:00:34 +00:00
|
|
|
Result ret = FSUSER_OpenFile(&handle, archive, fsMakePath(PATH_ASCII, path), FS_OPEN_READ, 0);
|
|
|
|
|
|
|
|
if(ret != 0)
|
|
|
|
return false;
|
2016-07-27 08:28:48 +00:00
|
|
|
|
2017-07-15 06:00:34 +00:00
|
|
|
ret = FSFILE_Close(handle);
|
|
|
|
|
|
|
|
if(ret != 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
2016-07-27 08:28:48 +00:00
|
|
|
}
|
|
|
|
|
2017-07-15 06:00:34 +00:00
|
|
|
bool dirExists(FS_Archive archive, const char * path)
|
|
|
|
{
|
|
|
|
if((!path) || (!archive))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
Handle handle;
|
2016-07-27 08:28:48 +00:00
|
|
|
|
2017-07-15 06:00:34 +00:00
|
|
|
Result ret = FSUSER_OpenDirectory(&handle, archive, fsMakePath(PATH_ASCII, path));
|
|
|
|
|
|
|
|
if(ret != 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
ret = FSDIR_Close(handle);
|
|
|
|
|
|
|
|
if(ret != 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
2016-07-27 08:28:48 +00:00
|
|
|
}
|