]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Wed, 15 Oct 2008 13:41:34 +0000 (13:41 +0000)
committerguigues <guigues>
Wed, 15 Oct 2008 13:41:34 +0000 (13:41 +0000)
kernel/appli/CMakeLists.txt
kernel/appli/bbPlugPackage/CMakeLists.txt [new file with mode: 0644]
kernel/appli/bbPlugPackage/bbPlugPackage.cpp [new file with mode: 0644]

index a1bbbf8cc760d7bf7754177178a16ba879c56d18..6d13435c29d0f6a6540ea4e44324d219f690e97f 100644 (file)
@@ -39,3 +39,5 @@ SUBDIRS(bbRegenerateBoxesLists)
 SUBDIRS(bbRegeneratePackageDoc)
 
 SUBDIRS(bbPostInstallPackage)
+
+SUBDIRS(bbPlugPackage)
diff --git a/kernel/appli/bbPlugPackage/CMakeLists.txt b/kernel/appli/bbPlugPackage/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f5ee6dd
--- /dev/null
@@ -0,0 +1,9 @@
+
+
+SET(SOURCES
+  bbPlugPackage
+  )
+
+ADD_EXECUTABLE(bbPlugPackage ${SOURCES})  
+TARGET_LINK_LIBRARIES(bbPlugPackage bbtk)
+INSTALL_TARGETS(/bin/ bbPlugPackage)
diff --git a/kernel/appli/bbPlugPackage/bbPlugPackage.cpp b/kernel/appli/bbPlugPackage/bbPlugPackage.cpp
new file mode 100644 (file)
index 0000000..2c7aadb
--- /dev/null
@@ -0,0 +1,56 @@
+
+#include <bbtkConfigurationFile.h>
+#include <bbtkUtilities.h>
+using namespace bbtk;
+//==========================================================================
+int main(int argc, char **argv)
+{
+  if (argc!=2)
+    {
+      std::cout << "usage : bbPlugPackage <path_to_package>" << std::endl;
+      return 0;
+    }
+
+  std::string path(argv[1]);
+  std::string fname = path + "/bbtkPackage"; 
+
+  if ( ! Utilities::FileExists( fname ) )
+    {
+      std::cout << "* ERROR : The directory '"<<path<<"' does not contain a 'bbtkPackage' file"
+               << std::endl;
+      return 1; 
+    }
+       
+  std::ifstream f;
+  f.open(fname.c_str());
+  std::string pname;
+  f >> pname;
+  f.close();
+  
+  
+  ConfigurationFile::GetInstance().AddPackagePathsAndWrite( path );
+  
+  std::string command;
+  command = ConfigurationFile::GetInstance().Get_bin_path();
+  command += ConfigurationFile::GetInstance().Get_file_separator();
+  command += "bbRegeneratePackageDoc " + pname + " -q && ";
+  command += ConfigurationFile::GetInstance().Get_bin_path();
+  command += ConfigurationFile::GetInstance().Get_file_separator();
+  command += "bbRegenerateBoxesLists -q ";
+  if ( ! system ( command.c_str() ) )
+    {
+      std::cout << "Package '" 
+               << pname << "' successfully plugged in" << std::endl;
+    }
+  else 
+    {
+      std::cout << "An error occured while running '" 
+               << command << "'" << std::endl;
+      return 1;
+    }
+  return 0;
+}
+//==========================================================================
+
+