From: Frederic Cervenansky Date: Mon, 9 May 2011 14:31:22 +0000 (+0000) Subject: avoid crash if no environment variable for bbtk not defined X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=972c7e6c2a94ec51ea3c8a57d5a1eeaf4755b1a2;p=crea.git avoid crash if no environment variable for bbtk not defined --- diff --git a/appli/creaNewProject/creaNewProject.cpp b/appli/creaNewProject/creaNewProject.cpp index 265d432..b0e9f8e 100644 --- a/appli/creaNewProject/creaNewProject.cpp +++ b/appli/creaNewProject/creaNewProject.cpp @@ -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 {