Added a new osgDB::appendPlatformSpecificLibraryFilePaths() method to FileUtils.cpp

Includes a new OSX code from Eric Wing
This commit is contained in:
Robert Osfield
2004-08-27 16:14:21 +00:00
parent 79bcd892bd
commit 255c27d552
6 changed files with 416 additions and 111 deletions

View File

@@ -251,12 +251,21 @@ void Registry::initDataFilePathList()
//PrintFilePathList(osg::notify(INFO),getDataFilePathList());
}
void Registry::setDataFilePathList(const std::string& paths)
{
_dataFilePath.clear();
convertStringPathIntoFilePathList(paths,_dataFilePath);
}
void Registry::setLibraryFilePathList(const std::string& paths) { _libraryFilePath.clear(); convertStringPathIntoFilePathList(paths,_libraryFilePath); }
#ifndef WIN32
static osg::ApplicationUsageProxy Registry_e1(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_LIBRARY_PATH <path>[:path]..","Paths for locating libraries/ plugins");
#else
static osg::ApplicationUsageProxy Registry_e1(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_LIBRARY_PATH <path>[;path]..","Paths for locating libraries/ plugins");
#endif
void Registry::initLibraryFilePathList()
{
//
@@ -273,85 +282,15 @@ void Registry::initLibraryFilePathList()
//notify(DEBUG_INFO) << "OSG_LD_LIBRARY_PATH("<<ptr<<")"<<std::endl;
setLibraryFilePathList(ptr);
}
#ifdef __sgi
convertStringPathIntoFilePathList("/usr/lib32/:/usr/local/lib32/",_libraryFilePath);
// bloody mess see rld(1) man page
#if (_MIPS_SIM == _MIPS_SIM_ABI32)
if( (ptr = getenv( "LD_LIBRARY_PATH" )))
{
convertStringPathIntoFilePathList(ptr,_libraryFilePath);
}
#elif (_MIPS_SIM == _MIPS_SIM_NABI32)
if( !(ptr = getenv( "LD_LIBRARYN32_PATH" )))
ptr = getenv( "LD_LIBRARY_PATH" );
if( ptr )
{
convertStringPathIntoFilePathList(ptr,_libraryFilePath);
}
#elif (_MIPS_SIM == _MIPS_SIM_ABI64)
if( !(ptr = getenv( "LD_LIBRARY64_PATH" )))
ptr = getenv( "LD_LIBRARY_PATH" );
if( ptr )
{
convertStringPathIntoFilePathList(ptr,_libraryFilePath);
}
#endif
#elif defined(__CYGWIN__)
if ((ptr = getenv( "PATH" )))
{
convertStringPathIntoFilePathList(ptr,_libraryFilePath);
}
convertStringPathIntoFilePathList("/usr/bin/:/usr/local/bin/",_libraryFilePath);
#elif defined(WIN32)
if ((ptr = getenv( "PATH" )))
{
convertStringPathIntoFilePathList(ptr,_libraryFilePath);
}
convertStringPathIntoFilePathList("C:/Windows/System/",_libraryFilePath);
#elif defined(__APPLE__)
if ((ptr = getenv( "DYLD_LIBRARY_PATH" )) )
{
convertStringPathIntoFilePathList(ptr, _libraryFilePath);
}
#else
if( (ptr = getenv( "LD_LIBRARY_PATH" )) )
{
convertStringPathIntoFilePathList(ptr,_libraryFilePath);
}
convertStringPathIntoFilePathList("/usr/lib/:/usr/local/lib/",_libraryFilePath);
#endif
appendPlatformSpecificLibraryFilePaths(_libraryFilePath);
//osg::notify(INFO)<<"Library FilePathList"<<std::endl;
//PrintFilePathList(osg::notify(INFO),getLibraryFilePathList());
}
void Registry::readCommandLine(osg::ArgumentParser& arguments)
{
// report the usage options.
@@ -1783,28 +1722,6 @@ ReaderWriter::WriteResult Registry::writeNodeImplementation(const Node& node,con
return results.front();
}
void Registry::convertStringPathIntoFilePathList(const std::string& paths,FilePathList& filepath)
{
#if defined(WIN32) && !defined(__CYGWIN__)
char delimitor = ';';
#else
char delimitor = ':';
#endif
if (!paths.empty())
{
std::string::size_type start = 0;
std::string::size_type end;
while ((end = paths.find_first_of(delimitor,start))!=std::string::npos)
{
filepath.push_back(std::string(paths,start,end-start));
start = end+1;
}
filepath.push_back(std::string(paths,start,std::string::npos));
}
}
void Registry::addEntryToObjectCache(const std::string& filename, osg::Object* object, double timestamp)
{