From c2d2fee474670be0ce744fb06369d31f5af849f1 Mon Sep 17 00:00:00 2001 From: Scott Fennell Date: Mon, 8 Jul 2019 09:28:53 -0500 Subject: [PATCH] #837 default input file to first argument if RUN_ is not present --- .../CommandLineArguments.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/trick_source/sim_services/CommandLineArguments/CommandLineArguments.cpp b/trick_source/sim_services/CommandLineArguments/CommandLineArguments.cpp index fc079c5c..bdd9dbb0 100644 --- a/trick_source/sim_services/CommandLineArguments/CommandLineArguments.cpp +++ b/trick_source/sim_services/CommandLineArguments/CommandLineArguments.cpp @@ -158,14 +158,19 @@ int Trick::CommandLineArguments::process_sim_args(int nargs , char **args) { if ( argc > 1 ) { - /* First occurnance of "RUN_*" is the input file name: '/' */ - for(int ii = 1; ii < argc; ii++) { - if(std::string(argv[ii]).find("RUN_") != std::string::npos) { - input_file = argv[ii]; - run_dir = argv[ii]; - break; + /* First occurnance of "RUN_*" is the input file name: '/'. + If not found, defaults to first argument */ + + input_file = argv[1]; + run_dir = argv[1]; + + for(int ii = 1; ii < argc; ii++) { + if(std::string(argv[ii]).find("RUN_") != std::string::npos) { + input_file = argv[ii]; + run_dir = argv[ii]; + break; + } } - } found = run_dir.find_last_of("/") ; if ( found != std::string::npos ) {