30 #include <boost/filesystem.hpp>
31 #include <boost/algorithm/string.hpp>
34 #ifndef PATH_MAX // If not defined yet : do it
35 # define PATH_MAX 2048
40 #pragma warning(disable: 4996)
104 boost::algorithm::replace_all( dpath,
122 const std::string &i_location)
140 const std::string &i_locDesc,
141 const std::string &i_locDB)
145 if (! boost::filesystem::exists(i_locDB) )
147 std::string mess =
"Local database '";
149 mess +=
"' does not exist : creating it";
154 if ( ! sqlTreeH->
Create(
true) )
165 if ( !sqlTreeH->
Open(
true) )
192 #define VALID_FILE_SEPARATOR "\\"
193 #define INVALID_FILE_SEPARATOR "/"
195 #define INVALID_FILE_SEPARATOR "\\"
196 #define VALID_FILE_SEPARATOR "/"
205 #if defined(__GNUC__)
207 #elif defined(_WIN32)
274 isdir = boost::filesystem::is_directory(settingsdirectory);
278 <<
"does not exist : creating it"<<std::endl);
287 boost::algorithm::replace_all( setDir,
291 boost::filesystem::create_directory( setDir );
292 setDir+=
"creaImageIO/";
293 boost::filesystem::create_directory( setDir );
296 if(!boost::filesystem::is_regular(setDir))
299 crea::System::GetAppPath(name,
PATH_MAX);
300 std::cout<<name<<std::endl;
302 std::string path=name;
303 path=path.substr(0,path.size()-1);
304 path=path.substr(0,path.find_last_of(
"/"));
310 path+=
"/bin/share/creaImageIO/";
314 path+=
"/../share/creaImageIO/";
316 #if defined(__APPLE__)
317 path+=
"/../../../../share/creaImageIO/";
323 std::cout <<
"From: " << path <<std::endl;
324 std::cout <<
"To: " << setDir <<std::endl;
325 boost::algorithm::replace_all( path,
328 boost::filesystem::copy_file(path,setDir);
355 TreeHandlerMapType::const_iterator i;
359 GimmickError(
"TreeHandler '"<<name<<
"' does not exist");
367 const std::vector<std::string>& filenames)
384 <<recurse<<std::endl);
445 const std::string& filename,
446 const std::vector<std::string>& params,
447 std::vector<std::string>& results)
462 if (i_attr.
inside.size() > 0)
464 std::map<std::string, std::string> map_attr;
467 if(i_attr.
inside.front() ==
"ALL")
469 std::map<std::string, std::string>::iterator it = map_attr.begin();
470 for(; it != map_attr.end(); it++)
471 i_res[it->first] = it->second;
475 std::vector<std::string>::iterator it = i_attr.
inside.begin();
476 for(; it != i_attr.
inside.end(); it++)
477 i_res[(*it)] = map_attr[(*it)];
526 std::vector<std::string> paths;
527 std::string separator =
";";
528 std::string::size_type last_pos = pathSettings.find_first_not_of(separator);
530 std::string::size_type pos = pathSettings.find_first_of(separator, last_pos);
531 while(std::string::npos != pos || std::string::npos != last_pos)
533 paths.push_back(pathSettings.substr(last_pos, pos - last_pos));
534 last_pos = pathSettings.find_first_not_of(separator, pos);
535 pos = pathSettings.find_first_of(separator, last_pos);
538 std::vector<std::string>::iterator it_path = paths.begin();
539 for(; it_path != paths.end(); ++it_path)
541 pos = it_path->find_last_of(
"\\");
542 last_pos = it_path->find_last_of(
".");
543 std::string name = it_path->substr(pos +1, last_pos -pos-1 );
544 addDB(name, it_path->c_str());
558 std::vector<std::string>::const_iterator it = i_attr.begin();
559 for (;it != i_attr.end(); it++)
563 infos.
inside.push_back((*it));
567 infos.
outside.push_back((*it));
575 std::stringstream mess;