diff --git a/libraries/libwhb/include/whb/file.h b/libraries/libwhb/include/whb/file.h index 914ccd2..93cd831 100644 --- a/libraries/libwhb/include/whb/file.h +++ b/libraries/libwhb/include/whb/file.h @@ -17,6 +17,9 @@ typedef enum WHBFileError WHB_FILE_FATAL_ERROR = -1, } WHBFileError; +BOOL +WHBDeInitFileSystem(); + int32_t WHBOpenFile(const char *path, const char *mode); diff --git a/libraries/libwhb/src/file.c b/libraries/libwhb/src/file.c index 8c19328..df12c7c 100644 --- a/libraries/libwhb/src/file.c +++ b/libraries/libwhb/src/file.c @@ -26,6 +26,20 @@ InitFileSystem() return TRUE; } +BOOL +WHBDeInitFileSystem() +{ + if (sInitialised) { + if (FSDelClient(&sClient, -1) != FS_STATUS_OK) { + return FALSE; + } + + sInitialised = FALSE; + } + + return TRUE; +} + int32_t WHBOpenFile(const char *path, const char *mode) diff --git a/libraries/libwhb/src/sdcard.c b/libraries/libwhb/src/sdcard.c index 83dfe52..8722ec2 100644 --- a/libraries/libwhb/src/sdcard.c +++ b/libraries/libwhb/src/sdcard.c @@ -74,6 +74,12 @@ WHBUnmountSdCard() WHBLogPrintf("%s: FSUnmount error %d", __FUNCTION__, result); return FALSE; } + + result = FSDelClient(&sClient, -1); + if (result < 0) { + WHBLogPrintf("%s: FSDelClient error %d", __FUNCTION__, result); + return FALSE; + } sMounted = FALSE; return TRUE;