Skip to content

Commit e5da14e

Browse files
committed
update mkdir() to return TRUE if directory already exists
Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 6706c8b commit e5da14e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/SD.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,12 @@ uint8_t SDClass::exists(const char *filepath)
9090
/**
9191
* @brief Create directory on the SD disk
9292
* @param filename: File name
93-
* @retval TRUE or FALSE
93+
* @retval TRUE if created or existing else FALSE
9494
*/
9595
uint8_t SDClass::mkdir(const char *filepath)
9696
{
97-
if (f_mkdir(filepath) != FR_OK) {
97+
FRESULT res = f_mkdir(filepath);
98+
if ((res != FR_OK) && (res != FR_EXIST)) {
9899
return FALSE;
99100
} else {
100101
return TRUE;

0 commit comments

Comments
 (0)