]> Creatis software - bbtk.git/blobdiff - kernel/appli/bbpConfigurator/bbpConfigurator.cpp
Merge branch 'origin/master'
[bbtk.git] / kernel / appli / bbpConfigurator / bbpConfigurator.cpp
index 8e151da84e477955c648d003e3fe1ffa424c54a5..fdabc26ed99cb56165e7c89f98c9e556baabac82 100644 (file)
@@ -55,7 +55,7 @@ int main(int argc, char **argv)
   // Check arguments
   if (argc != 4)
   {
-    std::cout << "usage : bbConfigurator <path_to_bbs> <package_name> <output_path>" << std::endl;
+    std::cout << "bbpConfigurator usage: bbConfigurator <path_to_bbs> <package_name> <output_path>" << 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<bf::path> 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<int> 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<bf::path> 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;
   }