// Copyright (C) 2002-2005 Gideon May (gideon@computer.org) // // Permission to copy, use, sell and distribute this software is granted // provided this copyright notice appears in all copies. // Permission to modify the code and to distribute modified code is granted // provided this copyright notice appears in all copies, and a notice // that the code was modified is included with the copyright notice. // // This software is provided "as is" without express or implied warranty, // and with no claim as to its suitability for any purpose. // // #include #include #include #include #include #include #include using namespace boost::python; using namespace osgDB; namespace { std::string findDataFile_1(const std::string& filename) { return osgDB::findDataFile(filename); } } namespace PyOSG { void init_FileUtils() { def("findDataFile", (std::string (*)(const std::string&,osgDB::CaseSensitivity)) &osgDB::findDataFile, "Search for specified file in file system, checking the DataFilePathList for possible paths,\n" "returning the full path of the first valid file found, return an empty string if no string is found.\n"); def("findDataFile", &findDataFile_1); def("setDataFilePathList", (void (*)(const std::string&)) &osgDB::setDataFilePathList); enum_ csense("CaseSensitivity"); # define OSG_ENUM_CSENSE(VALUE) \ (csense.value(#VALUE, osgDB::VALUE), \ def(#VALUE, object(osgDB::VALUE))) OSG_ENUM_CSENSE(CASE_SENSITIVE); OSG_ENUM_CSENSE(CASE_INSENSITIVE); enum_ filetype("FileType"); # define OSG_ENUM_FILETYPE(VALUE) \ (filetype.value(#VALUE, osgDB::VALUE), \ def(#VALUE, object(osgDB::VALUE))) OSG_ENUM_FILETYPE(FILE_NOT_FOUND); OSG_ENUM_FILETYPE(REGULAR_FILE); OSG_ENUM_FILETYPE(DIRECTORY); } } #if 0 inline void setDataFilePathList(const FilePathList& filepath) { osgDB::Registry::instance()->setDataFilePathList(filepath); } inline void setLibraryFilePathList(const FilePathList& filepaths) { osgDB::Registry::instance()->setLibraryFilePathList(filepaths); } inline void setLibraryFilePathList(const std::string& paths) { osgDB::Registry::instance()->setLibraryFilePathList(paths); } inline FilePathList& getLibraryFilePathList() { return osgDB::Registry::instance()->getLibraryFilePathList(); } extern OSGDB_EXPORT std::string findLibraryFile(const std::string& filename,CaseSensitivity caseSensitivity=CASE_SENSITIVE); /** convert a string containing a list of paths deliminated either with ';' (Windows) or ':' (All other platforms) into FilePath represetation.*/ extern OSGDB_EXPORT void convertStringPathIntoFilePathList(const std::string& paths,FilePathList& filepath); #endif