diff --git a/src/Command/CommandRun.cpp b/src/Command/CommandRun.cpp index d3449a6..83ce242 100644 --- a/src/Command/CommandRun.cpp +++ b/src/Command/CommandRun.cpp @@ -39,7 +39,7 @@ namespace Command { std::string command = file_name + ctx->project_name; success = system(command.c_str()); if (success != 0) { - std::cout << "Error running project" << std::endl; + std::cout << "Error running project!" << std::endl; return false; } diff --git a/src/Command/CommandDev.cpp b/src/Command/CommandWatcher.cpp similarity index 77% rename from src/Command/CommandDev.cpp rename to src/Command/CommandWatcher.cpp index 84e4b86..67c11be 100644 --- a/src/Command/CommandDev.cpp +++ b/src/Command/CommandWatcher.cpp @@ -113,20 +113,28 @@ namespace Command { watcher([this]() { #ifdef DEBUG - std::vector args_vec = args->operator[]("args").as>(); - std::string command_args = std::accumulate( + std::string command = "cmake ./build/ && ./build/make && ./build/" + ctx->build_dir + "/" + ctx->project_name; + if (args->count("args") != 0) { + std::cout << "No args provided" << std::endl; + std::vector args_vec = args->operator[]("args").as>(); + std::string command_args = std::accumulate( args_vec.begin(), args_vec.end(), args_vec[0], - [](std::string a, std::string b) { return a + " " + b; } - ); - const std::string command = "cmake ./build/ && make && ./build/" + ctx->build_dir + "/" + ctx->project_name + " " +command_args; -#else - std::vector args_vec = args->operator[]("args").as>(); - std::string command_args = std::accumulate( - args_vec.begin(), args_vec.end(), args_vec[0], - [](std::string a, std::string b) { return a + " " + b; } - ); + [](std::string a, std::string b) { return a + " " + b; }); - const std::string command = "cmake . && make && ./" + ctx->build_dir + "/" + ctx->project_name + " " + command_args; + command = "cmake ./build/ && make && ./build/" + ctx->build_dir + "/" + ctx->project_name + " " +command_args; + + } + +#else + std::string command = "cmake . && make && ./" + ctx->build_dir + "/" + ctx->project_name; + if (args->count("args") != 0) { + std::string command = "cmake . && make && ./ " + ctx->build_dir + "/" + ctx->project_name; + std::vector args_vec = args->operator[]("args").as>(); + std::string command_args = std::accumulate( + args_vec.begin(), args_vec.end(), args_vec[0], + [](std::string a, std::string b) { return a + " " + b; } + ); + } #endif int success = system(command.c_str()); if (success != 0) {