Show
Ignore:
Timestamp:
08/27/04 18:14:21 (10 years ago)
Author:
robert
Message:

Added a new osgDB::appendPlatformSpecificLibraryFilePaths() method to FileUtils?.cpp
Includes a new OSX code from Eric Wing

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgDB/Registry.cpp

    r2962 r3330  
    252252} 
    253253 
     254void Registry::setDataFilePathList(const std::string& paths) 
     255{ 
     256    _dataFilePath.clear();  
     257    convertStringPathIntoFilePathList(paths,_dataFilePath); 
     258} 
     259 
     260void Registry::setLibraryFilePathList(const std::string& paths) { _libraryFilePath.clear(); convertStringPathIntoFilePathList(paths,_libraryFilePath); } 
     261 
    254262#ifndef WIN32 
    255263static osg::ApplicationUsageProxy Registry_e1(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_LIBRARY_PATH <path>[:path]..","Paths for locating libraries/ plugins"); 
     
    258266#endif 
    259267 
     268 
    260269void Registry::initLibraryFilePathList() 
    261270{ 
     
    274283        setLibraryFilePathList(ptr); 
    275284    } 
    276  
    277 #ifdef __sgi 
    278  
    279     convertStringPathIntoFilePathList("/usr/lib32/:/usr/local/lib32/",_libraryFilePath); 
    280  
    281     // bloody mess see rld(1) man page 
    282     #if (_MIPS_SIM == _MIPS_SIM_ABI32) 
    283  
    284  
    285     if( (ptr = getenv( "LD_LIBRARY_PATH" ))) 
    286     { 
    287         convertStringPathIntoFilePathList(ptr,_libraryFilePath); 
    288     } 
    289  
    290     #elif (_MIPS_SIM == _MIPS_SIM_NABI32) 
    291  
    292     if( !(ptr = getenv( "LD_LIBRARYN32_PATH" ))) 
    293         ptr = getenv( "LD_LIBRARY_PATH" ); 
    294  
    295     if( ptr ) 
    296     { 
    297         convertStringPathIntoFilePathList(ptr,_libraryFilePath); 
    298     } 
    299  
    300     #elif (_MIPS_SIM == _MIPS_SIM_ABI64) 
    301  
    302     if( !(ptr = getenv( "LD_LIBRARY64_PATH" ))) 
    303         ptr = getenv( "LD_LIBRARY_PATH" ); 
    304  
    305     if( ptr ) 
    306     { 
    307         convertStringPathIntoFilePathList(ptr,_libraryFilePath); 
    308     } 
    309     #endif 
    310      
    311 #elif defined(__CYGWIN__) 
    312  
    313  
    314     if ((ptr = getenv( "PATH" ))) 
    315     { 
    316         convertStringPathIntoFilePathList(ptr,_libraryFilePath); 
    317     } 
    318  
    319     convertStringPathIntoFilePathList("/usr/bin/:/usr/local/bin/",_libraryFilePath); 
    320      
    321 #elif defined(WIN32) 
    322  
    323  
    324  
    325     if ((ptr = getenv( "PATH" ))) 
    326     { 
    327         convertStringPathIntoFilePathList(ptr,_libraryFilePath); 
    328     } 
    329  
    330     convertStringPathIntoFilePathList("C:/Windows/System/",_libraryFilePath); 
    331  
    332 #elif defined(__APPLE__) 
    333  
    334     if ((ptr = getenv( "DYLD_LIBRARY_PATH" )) ) 
    335     { 
    336         convertStringPathIntoFilePathList(ptr, _libraryFilePath); 
    337     } 
    338  
    339 #else    
    340  
    341     if( (ptr = getenv( "LD_LIBRARY_PATH" )) ) 
    342     { 
    343         convertStringPathIntoFilePathList(ptr,_libraryFilePath); 
    344     } 
    345  
    346     convertStringPathIntoFilePathList("/usr/lib/:/usr/local/lib/",_libraryFilePath); 
    347  
    348 #endif 
     285     
     286    appendPlatformSpecificLibraryFilePaths(_libraryFilePath); 
    349287 
    350288    //osg::notify(INFO)<<"Library FilePathList"<<std::endl; 
     
    352290 
    353291} 
     292 
    354293 
    355294void Registry::readCommandLine(osg::ArgumentParser& arguments) 
     
    17841723} 
    17851724 
    1786 void Registry::convertStringPathIntoFilePathList(const std::string& paths,FilePathList& filepath) 
    1787 { 
    1788 #if defined(WIN32) && !defined(__CYGWIN__) 
    1789     char delimitor = ';'; 
    1790 #else 
    1791     char delimitor = ':'; 
    1792 #endif 
    1793  
    1794     if (!paths.empty()) 
    1795     { 
    1796         std::string::size_type start = 0; 
    1797         std::string::size_type end; 
    1798         while ((end = paths.find_first_of(delimitor,start))!=std::string::npos) 
    1799         { 
    1800             filepath.push_back(std::string(paths,start,end-start)); 
    1801             start = end+1; 
    1802         } 
    1803  
    1804         filepath.push_back(std::string(paths,start,std::string::npos)); 
    1805     } 
    1806   
    1807 } 
    18081725 
    18091726void Registry::addEntryToObjectCache(const std::string& filename, osg::Object* object, double timestamp)