From: Kevin Day Date: Sat, 6 Jun 2020 21:46:26 +0000 (-0500) Subject: Bugfix: do not consider a non-existent build directory an error during clean operation X-Git-Tag: 0.5.0~213 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=845e6eb94f082302317b2cfc3321fa54c3da6cc2;p=fll Bugfix: do not consider a non-existent build directory an error during clean operation 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. --- diff --git a/level_3/fake/c/fake.c b/level_3/fake/c/fake.c index 45277f7..2db8ed2 100644 --- a/level_3/fake/c/fake.c +++ b/level_3/fake/c/fake.c @@ -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; } diff --git a/level_3/fake/c/private-clean.c b/level_3/fake/c/private-clean.c index 829df6b..f6d1b43 100644 --- a/level_3/fake/c/private-clean.c +++ b/level_3/fake/c/private-clean.c @@ -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; diff --git a/level_3/fake/c/private-fake.c b/level_3/fake/c/private-fake.c index 89d1985..bc2e6d1 100644 --- a/level_3/fake/c/private-fake.c +++ b/level_3/fake/c/private-fake.c @@ -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, diff --git a/level_3/fake/c/private-fake.h b/level_3/fake/c/private-fake.h index 77419b6..fad5760 100644 --- a/level_3/fake/c/private-fake.h +++ b/level_3/fake/c/private-fake.h @@ -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