X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fappli%2FbbpConfigurator%2FbbpConfigurator.cpp;h=fdabc26ed99cb56165e7c89f98c9e556baabac82;hb=18f3f2238cb97854f590dd8af0e9ab2a07de77a6;hp=8e151da84e477955c648d003e3fe1ffa424c54a5;hpb=9ca9baeef03df0bfaea871676ea7f8566e8124e7;p=bbtk.git diff --git a/kernel/appli/bbpConfigurator/bbpConfigurator.cpp b/kernel/appli/bbpConfigurator/bbpConfigurator.cpp index 8e151da..fdabc26 100644 --- a/kernel/appli/bbpConfigurator/bbpConfigurator.cpp +++ b/kernel/appli/bbpConfigurator/bbpConfigurator.cpp @@ -55,7 +55,7 @@ int main(int argc, char **argv) // Check arguments if (argc != 4) { - std::cout << "usage : bbConfigurator " << std::endl; + std::cout << "bbpConfigurator usage: bbConfigurator " << std::endl; return 1; } @@ -63,11 +63,39 @@ int main(int argc, char **argv) std::string package_name(argv[2]); std::string path_out(argv[3]); + std::cout << "bbpConfigurator launched with bbs path: '" << path_bbs << + "', package: '" << package_name << + "', output path: '" << path_out << "'." << std::endl; + // Get bbs files in path_bbs std::vector files = getFileList(path_bbs); if(files.size() == 0) { - std::cout << "No files to check." << std::endl; + std::cout << "bbpConfigurator: No files to check in bbs path. " + "An empty bbp will be created for the package '" << package_name << "'." << std::endl; + + // Write results to bbp file + #ifdef WIN32 + std::string fname = path_out + "\\" + package_name + ".bbp"; + #else + std::string fname = path_out + "/" + package_name + ".bbp"; + #endif + + std::ofstream out(fname.c_str()); + out << "#-----------------------------------------" << std::endl; + out << "# Include script for bbtk package '" << package_name << "'" << std::endl; + out << "# Automatically generated by bbpConfigurator" << std::endl; + out << "#-----------------------------------------" << std::endl; + out << "load "<< package_name << std::endl; + out << "#-----------------------------------------" << std::endl; + out << "package "<< package_name << std::endl; + out << "#-----------------------------------------" << std::endl; + out << "endpackage" << std::endl; + out << "#-- EOF ----------------------------------" << std::endl; + + out.close(); + + return 0; } @@ -138,12 +166,13 @@ int main(int argc, char **argv) // Check there are no cycles in graph if(isCycle(g)) { - std::cout << "there are dependency cycles, please check your scripts." << std::endl; + std::cout << "bbpConfigurator: There are dependency cycles, please check your scripts in '" << + path_bbs << "'. No bbp file created." << std::endl; return 2; } else { - std::cout << "no cycles, we keep going." << std::endl; + std::cout << "bbpConfigurator: No cycles detected in dependency graph." << std::endl; std::vector priorities(boxs.size(), -1); setPriorities(g, priorities); // for (int i = 0; i < (int)priorities.size(); i++) @@ -199,6 +228,8 @@ int main(int argc, char **argv) out << "#-- EOF ----------------------------------" << std::endl; out.close(); + + std::cout << "bbpConfigurator: bbp file created at '" << fname << "'." << std::endl; } return 0; } @@ -291,7 +322,7 @@ std::vector getFileList(const std::string& path) } else { - std::cout<< "the path to the bbs's should be a folder and not a file."; + std::cout<< "bbpConfigurator: The path to the bbs's doesn't exist or is not a folder. ('" << path << "')" << std::endl; return files; }