From 5f3f3b9dc72c97f77e96aebb1f90eed8f43d90c9 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Thu, 8 May 2025 21:28:08 -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 23cb7b2..e94d991 100644 --- a/level_1/fl_directory/c/directory.c +++ b/level_1/fl_directory/c/directory.c @@ -48,7 +48,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_none; } #endif // _di_fl_directory_create_ -- 1.8.3.1