Skip to content

Commit aba27c7

Browse files
committed
fs: Add FileExists
1 parent 4098b02 commit aba27c7

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

arm9/include/fs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ const char* GetWorkDir();
1313
/** Checks if there is enough space free on the SD card **/
1414
bool DebugCheckFreeSpace(size_t required);
1515

16+
/** Checks path exists */
17+
bool FileExists(const char* path);
18+
1619
/** Opens existing files */
1720
bool FileOpen(const char* path);
1821
bool DebugFileOpen(const char* path);

arm9/source/fs.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ bool DebugCheckFreeSpace(size_t required)
4848
return true;
4949
}
5050

51+
bool FileExists(const char* path)
52+
{
53+
FILINFO fno;
54+
55+
return f_stat(path, &fno) == FR_OK;
56+
}
57+
58+
5159
bool FileOpen(const char* path)
5260
{
5361
unsigned flags = FA_READ | FA_WRITE | FA_OPEN_EXISTING;

0 commit comments

Comments
 (0)