From efc107126a57a9dd6fe80c4d1778ed850b068159 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Thu, 8 May 2025 21:23:39 -0500 Subject: [PATCH] Bugfix: The fl_directory_create() is failing on directory exists with path ends in '/'. The final directory gets created in the loop before the final directory create is called. Check if the directory exists before the final directory create call. --- level_1/fl_directory/c/directory.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/level_1/fl_directory/c/directory.c b/level_1/fl_directory/c/directory.c index bb0ac9a..faab68e 100644 --- a/level_1/fl_directory/c/directory.c +++ b/level_1/fl_directory/c/directory.c @@ -43,7 +43,14 @@ extern "C" { } // for } - return f_directory_create(path, mode); + status = f_directory_exists(path); + if (F_status_is_error(status)) return status; + + if (status == F_false || status == F_file_found_not) { + return f_directory_create(path, mode); + } + + return F_okay; } #endif // _di_fl_directory_create_ -- 1.8.3.1