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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user