]> Creatis software - crea.git/commitdiff
avoid crash if no environment variable for bbtk not defined
authorFrederic Cervenansky <Frederic.Cervenansky@creatis.insa-lyon.fr>
Mon, 9 May 2011 14:31:22 +0000 (14:31 +0000)
committerFrederic Cervenansky <Frederic.Cervenansky@creatis.insa-lyon.fr>
Mon, 9 May 2011 14:31:22 +0000 (14:31 +0000)
appli/creaNewProject/creaNewProject.cpp

index 265d432b4e031c707ffc49d1b63dd5ca5ce53595..b0e9f8ee63b811eaba56d52241687d9f4f07071f 100644 (file)
@@ -36,12 +36,7 @@ bool myApp::OnInit( )
    if (description.IsEmpty()) return false;
 
 #if(_WIN32)
-        // \TODO rewrite, according to new trick // JPR
-       
-        char * install_Dir = getenv("bbtk_DIR");
-        std::string execGUICreateNewPackage(install_Dir);
-        execGUICreateNewPackage = "bbi " + execGUICreateNewPackage;
-
+     
        std::string command("creaNewProject.bat ");
        std::string command1("creaSed.exe ");
        std::string command2("del ");
@@ -59,8 +54,15 @@ bool myApp::OnInit( )
                 // Create a Package at the same time.   JPR
                
                /// \TODO rewrite, according to new trick // JPR
-                execGUICreateNewPackage += "\..\..\..\share\bbtk\bbs\toolsbbtk\appli\GUICreatePackage.bbs";
-                system(execGUICreateNewPackage.c_str());
+                                  // \TODO rewrite, according to new trick // JPR
+                                       char * install_Dir = getenv("bbtk_DIR");
+                                               if(install_Dir != NULL) // variable not always defined
+                                               {
+                                                       std::string execGUICreateNewPackage(install_Dir);
+                                                       execGUICreateNewPackage = "bbi " + execGUICreateNewPackage;
+                                       execGUICreateNewPackage += "\..\..\..\share\bbtk\bbs\toolsbbtk\appli\GUICreatePackage.bbs";
+                                                       system(execGUICreateNewPackage.c_str());
+                                               }
        }
        else 
        {