From: guigues Date: Wed, 26 Mar 2008 08:51:43 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: r0.6.1~90 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=b9da3baf83b7791357c78322e3280314ec782f40;p=bbtk.git *** empty log message *** --- diff --git a/kernel/src/bbtkInterpreter.cxx b/kernel/src/bbtkInterpreter.cxx index e4d872b..ab0075d 100644 --- a/kernel/src/bbtkInterpreter.cxx +++ b/kernel/src/bbtkInterpreter.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkInterpreter.cxx,v $ $ Language: C++ - Date: $Date: 2008/03/26 08:27:19 $ - Version: $Revision: 1.55 $ + Date: $Date: 2008/03/26 08:51:43 $ + Version: $Revision: 1.56 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -973,7 +973,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& std::string upath; pkgname = Utilities::ExtractScriptName(name,upath); - bbtkMessage("Interpreter",1, + bbtkMessage("Interpreter",3, "extract : pkgname [" << pkgname << "] upath [" << upath << "]" << std::endl); bool fullnameGiven = false; @@ -997,7 +997,14 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& // ==== absolute path provided else if (upath[0]=='/' || upath[1] == ':' ) { - script_paths.push_back(upath); + if ( Utilities::IsDirectory( upath ) ) + { + script_paths.push_back(upath); + } + else + { + bbtkError("'"<& i++) { std::string full_path(*i); + // we *really* want '.' to be the current working directory + if (full_path == ".") { + char buf[2048]; // for getcwd + char * currentDir = getcwd(buf, 2048); + std::string cwd(currentDir); + full_path = currentDir; + } // if full_path + full_path += ConfigurationFile::GetInstance().Get_file_separator(); full_path += upath; - script_paths.push_back(full_path); - } - } + + if ( Utilities::IsDirectory( full_path ) ) + { + script_paths.push_back(full_path); + } + } + } // === search paths list complete : now explore it - bbtkMessage("Interpreter",1, - "'*' provided. search paths : " << std::endl); - /* - int nbFiles = Utilities::Explore(upath, false, Filenames); - nbBssFiles = 0; - for (std::vector::iterator i = Filenames.begin(); - i!= Filenames.end(); ++i) - { - int lgr = (*i).size(); - if (lgr < 5) - continue; // ignore non .bbs file - if ((*i).substr(lgr-4, 4) != ".bbs") - continue; - //printf("EED Interpreter::SwitchToFile flag01 %s \n", (*i).c_str() ); - (*stream) << "include \"" << *i << "\"\n"; - - nbBssFiles++; - } // for vector - if (nbBssFiles==0) - { - bbtkMessage("Interpreter",2, - "WARNING : No '.bbs' file found in [" - << upath << "]" << std::endl); - } - else - { - SwitchToStream(stream); - } - return; - } // if upath - */ - std::string path; + if (script_paths.empty()) + { + bbtkMessage("Interpreter",1, + "'"<::iterator i; - std::string fullDirectoryName; for (i=script_paths.begin();i!=script_paths.end();i++)// ==== relative name, iterate + load all .bbs files { - path = *i; - bbtkMessage("Interpreter",1, - "----> '" << path << "'" << std::endl); - // we *really* want '.' to be the current working directory - if (path == ".") { - char buf[2048]; // for getcwd - char * currentDir = getcwd(buf, 2048); - std::string cwd(currentDir); - path = currentDir; - } // if path - - fullDirectoryName = Utilities::MakePkgnameFromPath(path, upath, false); - - // without last slash "\" - std::string fullDirectoryNameClean = fullDirectoryName.substr(0,fullDirectoryName.size()-1); - - // Check if directory exists - if ( ! Utilities::IsDirectory( fullDirectoryNameClean ) ) - { - // The following is *NOT* a debug time message : - // It's a user intended message. - // Please don't remove it. - bbtkMessage("Interpreter",1," [" < Looking in '" << *i << "'" << std::endl); + Filenames.clear(); - int nbFiles = Utilities::Explore(fullDirectoryName, false, Filenames); + int nbFiles = Utilities::Explore(*i, false, Filenames); nbBssFiles = 0; - for (std::vector::iterator i = Filenames.begin(); i!= Filenames.end(); ++i) + for (std::vector::iterator j = Filenames.begin(); + j!= Filenames.end(); ++j) { - int lgr = (*i).size(); + int lgr = (*j).size(); if (lgr < 5) continue; // ignore non .bbs file - if ((*i).substr(lgr-4, 4) != ".bbs") + if ((*j).substr(lgr-4, 4) != ".bbs") continue; - // printf("EED Interpreter::SwitchToFile flag02 %s \n", (*i).c_str() ); - (*stream) << "include \"" << *i << "\"\n"; + (*stream) << "include \"" << *j << "\"\n"; + bbtkMessage("Interpreter",2, + " --> Found '" << *j << "'" << std::endl); nbBssFiles++; } // for vector + if (nbBssFiles==0) { bbtkMessage("Interpreter",1, - "WARNING : No '.bbs' file found in [" - << fullDirectoryName << "]" << std::endl); + " --> No .bbs found"<< std::endl); } else { + bbtkMessage("Interpreter",1, + " --> "<