diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 6cc9639..9c5bea2 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -6,6 +6,7 @@ "${workspaceFolder}/**", "/usr/include/c++/14/", "/usr/include/linux/", + "/usr/include/", "/home/GHo/Documents/Code/NebulOuS/Solver/", "/home/GHo/Documents/Code/Theron++/", "/home/GHo/Documents/Code/CxxOpts/include/", @@ -31,6 +32,7 @@ "/home/GHo/Documents/Code/Theron++/", "/home/GHo/Documents/Code/CxxOpts/include/", "/opt/AMPL/amplapi/include/", + "/usr/include/", "/usr/include/c++/14/", "/usr/include/linux/" ], diff --git a/AMPLSolver.cpp b/AMPLSolver.cpp index caeab6a..0d799f9 100644 --- a/AMPLSolver.cpp +++ b/AMPLSolver.cpp @@ -41,6 +41,9 @@ std::string AMPLSolver::SaveFile( std::string_view TheName, if( TheFile.is_open() ) { + Theron::ConsoleOutput Output; + Output << "AMPL Solver saving the file: " << TheFileName << std::endl; + TheFile << TheContent; TheFile.close(); return TheFileName; diff --git a/SolverComponent.cpp b/SolverComponent.cpp index 163e82c..d8e8250 100644 --- a/SolverComponent.cpp +++ b/SolverComponent.cpp @@ -187,8 +187,24 @@ int main( int NumberOfCLIOptions, char ** CLIOptionStrings ) std::filesystem::path ModelDirectory( CLIValues["ModelDir"].as() ); - if( ModelDirectory.empty() || !std::filesystem::exists( ModelDirectory ) ) + if( ModelDirectory.empty() ) ModelDirectory = std::filesystem::temp_directory_path(); + else if ( !std::filesystem::exists( ModelDirectory ) ) + { + if( !std::filesystem::create_directory( ModelDirectory ) ) + { + std::source_location Location = std::source_location::current(); + std::ostringstream ErrorMessage; + + ErrorMessage << "[" << Location.file_name() << " at line " + << Location.line() << "in function " + << Location.function_name() <<"] " + << "The requested model directory " << ModelDirectory + << " does not exist and cannot be created"; + + throw std::runtime_error( ErrorMessage.str() ); + } + } // -------------------------------------------------------------------------- // AMQ options