Skip to content

Commit

Permalink
fix flowchart loading on GUI app
Browse files Browse the repository at this point in the history
  • Loading branch information
Ylannl committed Mar 29, 2020
1 parent d934679 commit cb69572
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions apps/geoflow-app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ int main(int argc, const char * argv[]) {
CLI::Option* opt_log = cli.add_option("-l,--log", log_filename, "Write log to file");

auto sc_flowchart = cli.add_subcommand("", "Load flowchart");
CLI::Option* opt_flowchart_path = sc_flowchart->add_option("flowchart", flowchart_path, "Flowchart file")->required();
CLI::Option* opt_flowchart_path = sc_flowchart->add_option("flowchart", flowchart_path, "Flowchart file");
#ifndef GF_BUILD_WITH_GUI
opt_flowchart_path->required();
#endif
auto sc_info = cli.add_subcommand("info", "Print info")->excludes(sc_flowchart);

sc_info->parse_complete_callback([&plugin_manager, &node_registers, &plugin_folder](){
Expand All @@ -115,7 +118,7 @@ int main(int argc, const char * argv[]) {
if(fs::exists(abs_path)) {
flowchart.load_json(flowchart_path);
}
}
}
});

// handle cli globals
Expand Down Expand Up @@ -158,6 +161,16 @@ int main(int argc, const char * argv[]) {

// launch gui or just run the flowchart in cli mode
#ifdef GF_BUILD_WITH_GUI
if(!*opt_flowchart_path) {
load_plugins(plugin_manager, node_registers, plugin_folder);
// set current work directory to folder containing flowchart file
auto abs_path = fs::absolute(fs::path(flowchart_path));
fs::current_path(abs_path.parent_path());
flowchart_path = abs_path.string();
if(fs::exists(abs_path)) {
flowchart.load_json(flowchart_path);
}
}
launch_flowchart(flowchart, flowchart_path);
#else
flowchart.run_all();
Expand Down

0 comments on commit cb69572

Please sign in to comment.