From ec25377962a16801cf4078872a7504248a791187 Mon Sep 17 00:00:00 2001 From: Javier Segovia Date: Fri, 29 Sep 2023 14:00:26 +0200 Subject: [PATCH] Output folder-file for repair mode --- src/runner.h | 1 - src/utils/argument_parser.h | 7 ++++++- src/utils/bfgp_utils.h | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/runner.h b/src/runner.h index f38f4fff1..442e8d122 100644 --- a/src/runner.h +++ b/src/runner.h @@ -56,7 +56,6 @@ namespace runner{ if(resulting_node != nullptr ){ auto resulting_program = resulting_node->get_program(); utils::print_to_file(dest_file_name+".prog", resulting_program->to_string(false)); - //utils::print_to_file(output_file+".prog", resulting_program->to_string(false)); stats_info->add_info_msg("SOLUTION FOUND!!!\n" + resulting_program->to_string(false)); } else{ diff --git a/src/utils/argument_parser.h b/src/utils/argument_parser.h index b9c942156..d41c2efa5 100644 --- a/src/utils/argument_parser.h +++ b/src/utils/argument_parser.h @@ -209,7 +209,12 @@ namespace utils { _program_lines = read_program_instructions(_program_file_name).size(); auto folder_files = utils::split(_program_file_name,"/"); // Get the file name of the input program - _output_file = utils::split(folder_files[folder_files.size()-1],".")[0]; + auto program_name = utils::split(folder_files[folder_files.size()-1],".")[0]; + if(_output_file.empty()) + _output_file = program_name; + else if(_output_file[_output_file.size()-1] == '/') // if the output is a folder + _output_file += program_name; + // else // do nothing, keep the folder/file input values } if (arg_map.find(_theory_ntype) == arg_map.end()) _theory_name = "cpp"; diff --git a/src/utils/bfgp_utils.h b/src/utils/bfgp_utils.h index 169a78563..6ddcc1269 100644 --- a/src/utils/bfgp_utils.h +++ b/src/utils/bfgp_utils.h @@ -90,7 +90,8 @@ namespace utils{ if(not out_file.empty()){ auto problem_folders = split(out_file, "/"); // last is the output file out_folder = ""; - for(size_t idx=0; idx+1