]> Kevux Git Server - fll/commitdiff
Bugfix: do not consider a non-existent build directory an error during clean operation
authorKevin Day <thekevinday@gmail.com>
Sat, 6 Jun 2020 21:46:26 +0000 (16:46 -0500)
committerKevin Day <thekevinday@gmail.com>
Sat, 6 Jun 2020 21:46:26 +0000 (16:46 -0500)
The clean only cares about deleting all of the files in the build directory.
If that directory does not exist, then there is no issue.
When in verbose mode, print a message about the directory not existing.

level_3/fake/c/fake.c
level_3/fake/c/private-clean.c
level_3/fake/c/private-fake.c
level_3/fake/c/private-fake.h

index 45277f73a44fadb3ca9764668abf4e208bbca4b0..2db8ed2a82945eeb49aeba04e117cbc80987bcd1 100644 (file)
@@ -278,7 +278,7 @@ extern "C" {
 
         if (operations[i] == fake_operation_build) {
           if (validate_parameter_directories) {
-            status = fake_validate_parameter_directories(arguments, *data);
+            status = fake_validate_parameter_directories(arguments, *data, F_true);
             validate_parameter_directories = F_false;
           }
 
@@ -288,7 +288,7 @@ extern "C" {
         }
         else if (operations[i] == fake_operation_clean) {
           if (validate_parameter_directories) {
-            status = fake_validate_parameter_directories(arguments, *data);
+            status = fake_validate_parameter_directories(arguments, *data, F_false);
             validate_parameter_directories = F_false;
           }
 
@@ -298,7 +298,7 @@ extern "C" {
         }
         else if (operations[i] == fake_operation_make) {
           if (validate_parameter_directories) {
-            status = fake_validate_parameter_directories(arguments, *data);
+            status = fake_validate_parameter_directories(arguments, *data, F_true);
             validate_parameter_directories = F_false;
           }
 
index 829df6b49b476c4fed990f22b453ded9e76968cf..f6d1b43d4b8d71eb8d353b59fb8e79d1b6ff506f 100644 (file)
@@ -25,6 +25,14 @@ extern "C" {
       status = f_directory_remove(data.path_build.string, f_directory_descriptors_max, F_true);
     }
 
+    if (F_status_set_fine(status) == F_file_found_not) {
+      if (data.verbosity == fake_verbosity_verbose) {
+        fl_color_print_line(f_type_output, data.context.standout, data.context.reset, "The build directoy '%s' does not exist.", data.path_build.string);
+      }
+
+      status = F_none;
+    }
+
     if (F_status_is_error(status)) {
       fake_print_error(data.context, data.verbosity, F_status_set_fine(status), "f_directory_remove", F_true);
       return status;
index 89d1985e70e9ed246871ceaffc2fdcfeea89be93..bc2e6d1a34f85491d6ec777c1d57af260e4e1216 100644 (file)
@@ -707,7 +707,7 @@ extern "C" {
 #endif // _di_fake_process_console_parameters_
 
 #ifndef _di_fake_validate_directories_
-  f_return_status fake_validate_parameter_directories(const f_console_arguments arguments, const fake_data data) {
+  f_return_status fake_validate_parameter_directories(const f_console_arguments arguments, const fake_data data, const bool build_required) {
     const f_string parameters_name[] = {
       fake_long_path_build,
       fake_long_path_data,
@@ -737,7 +737,7 @@ extern "C" {
     };
 
     const bool parameters_required[] = {
-      F_true,
+      build_required,
       F_true,
       F_true,
       F_false,
index 77419b6bc16969bc44cf1abfcec3b2f7fa27923c..fad576034b87ca0319e213dcb3f076ef37f75073 100644 (file)
@@ -99,13 +99,16 @@ extern "C" {
  *   The parameters passed to the process.
  * @param data
  *   The program data.
+ * @param build_required
+ *   Set to TRUE to require the build directory.
+ *   Set to FALSE to not require the build directory.
  *
  * @return
  *   F_none on success.
  *   Status codes (with error bit) are returned on any problem.
  */
 #ifndef _di_fake_validate_parameter_directories_
-  extern f_return_status fake_validate_parameter_directories(const f_console_arguments arguments, const fake_data data) f_gcc_attribute_visibility_internal;
+  extern f_return_status fake_validate_parameter_directories(const f_console_arguments arguments, const fake_data data, const bool build_required) f_gcc_attribute_visibility_internal;
 #endif // _di_fake_validate_parameter_directories_
 
 #ifdef __cplusplus