From 972c7e6c2a94ec51ea3c8a57d5a1eeaf4755b1a2 Mon Sep 17 00:00:00 2001 From: Frederic Cervenansky Date: Mon, 9 May 2011 14:31:22 +0000 Subject: [PATCH] avoid crash if no environment variable for bbtk not defined --- appli/creaNewProject/creaNewProject.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) 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 { -- 2.47.1