+
+
+ int nbFiles = Utilities::Explore(fullDirectoryName, false, Filenames);
+
+ nbBssFiles = 0;
+ for (std::vector<std::string>::iterator i = Filenames.begin(); i!= Filenames.end(); ++i)
+ {
+
+ if ((*i).substr((*i).size()-4, 4) != ".bbs")
+ continue; // ignore non .bbs files
+ LoadScript(*i,name);
+ nbBssFiles++;
+ }
+ if (nbBssFiles==0)
+ bbtkMessage("Interpreter",1,
+ "WARNING : No '.bbs' file found in ["
+ << fullDirectoryName << "]" << std::endl);
+
+ //break; // a directory was found; we stop iterating
+ // LG : No! We want all files included !
+ }
+ return;
+ }
+
+ //std::string::size_type slash_position = name.find_last_of("/\\");
+
+ // if name starts with a / or a . or contains : user is assumed to have passed a relative/absolute name
+ // (not only a plain script name)
+ // we trust him, and try to expland the directory name
+ // WARNING : starting from current local directory : ./whatYouWant (./ mandatory!)
+
+ if (name[0]=='/' || name[1] == ':' || name[0]=='.') // absolute path (linux/windows) or relative path
+ {
+
+ // ===========================================================check user supplied location
+ fullnameGiven = true;
+
+
+ fullPathScriptName = Utilities::ExpandLibName(name, false);
+
+ // allow user to always forget ".bbs"
+ int l = fullPathScriptName.size();
+
+ if (l!=0) {
+
+ if (l>4)
+ {
+ if (fullPathScriptName.substr(l-4, 4) != ".bbs")
+ {
+ fullPathScriptName = fullPathScriptName + ".bbs";
+ }
+ }
+ else
+ {
+ fullPathScriptName = fullPathScriptName + ".bbs";
+ }
+
+ if ( Utilities::FileExists(fullPathScriptName))
+ {
+ foundFile = true;
+ }
+ } // endif l != 0
+ }
+ else
+
+ // =============================================================== iterate on the paths
+ {
+ std::string path;
+ std::vector<std::string>::iterator i;
+ for (i=script_paths.begin();i!=script_paths.end();++i)
+ {
+
+ path = *i;
+ // 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;
+ }
+
+ // fullPathScriptName = Utilities::MakePkgnameFromPath(path, name, true); //pkgname);
+
+ fullPathScriptName = Utilities::MakePkgnameFromPath(path, name, true);
+
+
+ // Check if library exists
+ if ( ! Utilities::FileExists(fullPathScriptName) )
+ {
+ // The following is *NOT* a debug time message :
+ // It's a user intended message.
+ // Please don't remove it.
+ bbtkMessage("Interpreter",2,
+ " [" <<fullPathScriptName <<"] : doesn't exist"
+ <<std::endl);
+ continue; // try next path
+ }
+ bbtkMessage("Interpreter",2,
+ " [" <<fullPathScriptName
+ <<"] : found" <<std::endl);
+ foundFile = true;