From Michael Platings, Converted std::fstream/ifstream/ofstream to osgDB::fstream/ifstream/ofstream and

fopen to osgDB::fopen to facilitate support for wide character filenames using UT8 encoding.
This commit is contained in:
Robert Osfield
2008-11-07 15:08:08 +00:00
parent 0ccf7d8383
commit 720551d549
76 changed files with 516 additions and 161 deletions

View File

@@ -15,6 +15,8 @@
#include <osg/ref_ptr>
#include <osg/io_utils>
#include <osgDB/FileUtils>
#if defined(WIN32) && !defined(__CYGWIN__)
#include <io.h>
#include <windows.h>
@@ -573,11 +575,6 @@ void CameraConfig::scaleCameraOffset( osg::Matrix::value_type x, osg::Matrix::va
memcpy( _offset_matrix, m.ptr(), sizeof( osg::Matrix::value_type[16] ));
}
bool CameraConfig::fileExists(const std::string& filename)
{
return access( filename.c_str(), F_OK ) == 0;
}
// Order of precedence:
//
std::string CameraConfig::findFile( std::string filename )
@@ -590,23 +587,23 @@ std::string CameraConfig::findFile( std::string filename )
if( ptr != NULL )
{
path = std::string(ptr) + '/' + filename;
if( fileExists(path))
if( osgDB::fileExists(path))
return path;
}
// Check standard location(s)
//path.clear();
path = std::string( "/usr/local/share/Producer/Config/") + filename;
if( fileExists(path) )
if( osgDB::fileExists(path) )
return path;
//path.clear();
path = std::string( "/usr/share/Producer/Config/") + filename;
if( fileExists(path) )
if( osgDB::fileExists(path) )
return path;
// Check local directory
if(fileExists(filename))
if(osgDB::fileExists(filename))
return filename;
// Fail