From f25c0c60a83cb676c3cb96a7baa8df418fa0ab68 Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 13 Mar 2020 09:50:43 +0000 Subject: [PATCH] Use UTF8 paths in nearly all places, for OSG We already request OSG to use UTF8 paths, so ensure whenever we pass an SGPath to OSG, we use the correct conversion function. --- simgear/ephemeris/ephemeris.cxx | 4 ++-- simgear/ephemeris/ephemeris.hxx | 2 +- simgear/io/iostreams/sgstream.cxx | 8 ++++---- simgear/misc/path_test.cxx | 7 +++++++ simgear/misc/sg_dir.cxx | 10 +++++----- simgear/misc/sg_path.cxx | 4 ++-- simgear/scene/material/mat.cxx | 10 +++++----- simgear/scene/material/matlib.cxx | 4 ++-- simgear/scene/material/matlib.hxx | 3 ++- simgear/scene/model/SGReaderWriterXML.cxx | 10 +++++----- simgear/scene/model/SGText.cxx | 2 +- simgear/scene/model/model.hxx | 4 ++-- simgear/scene/model/modellib.cxx | 16 +++++++++++++++- simgear/scene/model/modellib.hxx | 6 +++++- simgear/scene/sky/cloud.cxx | 2 +- simgear/scene/sky/moon.cxx | 2 +- simgear/scene/sky/newcloud.cxx | 2 +- simgear/scene/sky/oursun.cxx | 2 +- simgear/scene/tgdb/ReaderWriterSTG.cxx | 10 +++++----- simgear/scene/util/SGReaderWriterOptions.cxx | 6 +++--- simgear/scene/util/SGReaderWriterOptions.hxx | 7 +++---- simgear/timing/sg_time.cxx | 2 +- simgear/timing/sg_time.hxx | 2 +- 23 files changed, 75 insertions(+), 50 deletions(-) mode change 100644 => 100755 simgear/misc/path_test.cxx diff --git a/simgear/ephemeris/ephemeris.cxx b/simgear/ephemeris/ephemeris.cxx index a05481bd..f918c3f7 100644 --- a/simgear/ephemeris/ephemeris.cxx +++ b/simgear/ephemeris/ephemeris.cxx @@ -31,7 +31,7 @@ // Constructor -SGEphemeris::SGEphemeris( const std::string &path ) { +SGEphemeris::SGEphemeris( const SGPath& path ) { our_sun = new Star; moon = new MoonPos; mercury = new Mercury; @@ -44,7 +44,7 @@ SGEphemeris::SGEphemeris( const std::string &path ) { nplanets = 7; for ( int i = 0; i < nplanets; ++i ) planets[i] = SGVec3d::zeros(); - stars = new SGStarData( SGPath(path) ); + stars = new SGStarData(path); } diff --git a/simgear/ephemeris/ephemeris.hxx b/simgear/ephemeris/ephemeris.hxx index 398eb3ef..abe5a8a0 100644 --- a/simgear/ephemeris/ephemeris.hxx +++ b/simgear/ephemeris/ephemeris.hxx @@ -97,7 +97,7 @@ public: * calling the constructor you need to provide a path pointing to * your star database file. * @param path path to your star database */ - SGEphemeris( const std::string &path ); + SGEphemeris( const SGPath &path ); /** Destructor */ ~SGEphemeris( void ); diff --git a/simgear/io/iostreams/sgstream.cxx b/simgear/io/iostreams/sgstream.cxx index 77c30f1f..fc20e73a 100644 --- a/simgear/io/iostreams/sgstream.cxx +++ b/simgear/io/iostreams/sgstream.cxx @@ -212,7 +212,7 @@ sg_ifstream::sg_ifstream(const SGPath& path, ios_openmode io_mode) #if defined(SG_WINDOWS) std::wstring ps = path.wstr(); #else - std::string ps = path.local8BitStr(); + std::string ps = path.utf8Str(); #endif std::ifstream::open(ps.c_str(), io_mode); } @@ -222,7 +222,7 @@ void sg_ifstream::open( const SGPath& name, ios_openmode io_mode ) #if defined(SG_WINDOWS) std::wstring ps = name.wstr(); #else - std::string ps = name.local8BitStr(); + std::string ps = name.utf8Str(); #endif std::ifstream::open(ps.c_str(), io_mode); } @@ -232,7 +232,7 @@ sg_ofstream::sg_ofstream(const SGPath& path, ios_openmode io_mode) #if defined(SG_WINDOWS) std::wstring ps = path.wstr(); #else - std::string ps = path.local8BitStr(); + std::string ps = path.utf8Str(); #endif std::ofstream::open(ps.c_str(), io_mode); } @@ -242,7 +242,7 @@ void sg_ofstream::open( const SGPath& name, ios_openmode io_mode ) #if defined(SG_WINDOWS) std::wstring ps = name.wstr(); #else - std::string ps = name.local8BitStr(); + std::string ps = name.utf8Str(); #endif std::ofstream::open(ps.c_str(), io_mode); } diff --git a/simgear/misc/path_test.cxx b/simgear/misc/path_test.cxx old mode 100644 new mode 100755 index dac7c0d2..9ae36245 --- a/simgear/misc/path_test.cxx +++ b/simgear/misc/path_test.cxx @@ -333,6 +333,12 @@ void test_hash_function() SG_CHECK_NE(std::hash{}(p), std::hash{}(p / "foobar")); } +void test_null_path() +{ + const SGPath nullPath; + SG_VERIFY(!nullPath.exists()); +} + int main(int argc, char* argv[]) { SGPath pa; @@ -441,6 +447,7 @@ int main(int argc, char* argv[]) test_update_dir(); test_comparisons(); test_hash_function(); + test_null_path(); cout << "all tests passed OK" << endl; return 0; // passed diff --git a/simgear/misc/sg_dir.cxx b/simgear/misc/sg_dir.cxx index 9430e1b2..0836a49b 100644 --- a/simgear/misc/sg_dir.cxx +++ b/simgear/misc/sg_dir.cxx @@ -115,7 +115,7 @@ Dir Dir::tempDir(const std::string& templ) // Mac OS-X / BSD manual says any number of 'X's, but GLibc manual // says exactly six, so that's what I'm going with p.concat("-XXXXXX"); - std::string s = p.local8BitStr(); + std::string s = p.utf8Str(); ::snprintf(buf, 1024, "%s", s.c_str()); if (!mkdtemp(buf)) { SG_LOG(SG_IO, SG_WARN, @@ -206,7 +206,7 @@ PathList Dir::children(int types, const std::string& nameFilter) const FindClose(find); #else - std::string ps = _path.local8BitStr(); + std::string ps = _path.utf8Str(); DIR* dp = opendir(ps.c_str()); if (!dp) { SG_LOG(SG_GENERAL, SG_WARN, "Dir::children: opendir failed:" << _path); @@ -290,7 +290,7 @@ bool Dir::isEmpty() const std::wstring ps = _path.wstr(); return PathIsDirectoryEmptyW( ps.c_str() ); #else - std::string ps = _path.local8BitStr(); + std::string ps = _path.utf8Str(); DIR* dp = opendir( ps.c_str() ); if (!dp) return true; @@ -339,7 +339,7 @@ bool Dir::create(mode_t mode) std::wstring ps = _path.wstr(); int err = _wmkdir(ps.c_str()); #else - std::string ps = _path.local8BitStr(); + std::string ps = _path.utf8Str(); int err = mkdir(ps.c_str(), mode); #endif if (err) { @@ -394,7 +394,7 @@ bool Dir::remove(bool recursive) std::wstring ps = _path.wstr(); int err = _wrmdir(ps.c_str()); #else - std::string ps = _path.local8BitStr(); + std::string ps = _path.utf8Str(); int err = rmdir(ps.c_str()); #endif if (err) { diff --git a/simgear/misc/sg_path.cxx b/simgear/misc/sg_path.cxx index 3d0e41b1..a252480f 100644 --- a/simgear/misc/sg_path.cxx +++ b/simgear/misc/sg_path.cxx @@ -786,8 +786,8 @@ bool SGPath::rename(const SGPath& newName) std::wstring np = newName.wstr(); if (_wrename(p.c_str(), np.c_str()) != 0) #else - std::string p = local8BitStr(); - std::string np = newName.local8BitStr(); + std::string p = utf8Str(); + std::string np = newName.utf8Str(); if( ::rename(p.c_str(), np.c_str()) != 0 ) #endif diff --git a/simgear/scene/material/mat.cxx b/simgear/scene/material/mat.cxx index 1ebb86b1..6bedbdcd 100644 --- a/simgear/scene/material/mat.cxx +++ b/simgear/scene/material/mat.cxx @@ -149,7 +149,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options, SGPath tpath("Textures"); tpath.append(tname); - std::string fullTexPath = SGModelLib::findDataFile(tpath.local8BitStr(), options); + std::string fullTexPath = SGModelLib::findDataFile(tpath, options); if (fullTexPath.empty()) { SG_LOG(SG_GENERAL, SG_ALERT, "Cannot find texture \"" << tname << "\" in Textures folders."); @@ -181,7 +181,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options, SGPath tpath("Textures"); tpath.append(tname); - std::string fullTexPath = SGModelLib::findDataFile(tpath.local8BitStr(), options); + std::string fullTexPath = SGModelLib::findDataFile(tpath, options); if (fullTexPath.empty()) { SG_LOG(SG_GENERAL, SG_ALERT, "Cannot find texture \"" << tname << "\" in Textures folders."); @@ -207,7 +207,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options, SGPath tpath("Textures"); tpath.append("Terrain"); tpath.append("unknown.rgb"); - _internal_state st( NULL, tpath.local8BitStr(), true, options ); + _internal_state st( NULL, tpath.utf8Str(), true, options ); _status.push_back( st ); } @@ -219,7 +219,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options, if (! omname.empty()) { SGPath ompath("Textures"); ompath.append(omname); - std::string fullMaskPath = SGModelLib::findDataFile(ompath.local8BitStr(), options); + std::string fullMaskPath = SGModelLib::findDataFile(ompath, options); if (fullMaskPath.empty()) { SG_LOG(SG_GENERAL, SG_ALERT, "Cannot find texture \"" @@ -358,7 +358,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options, if (! treeTexPath.empty()) { SGPath treePath("Textures"); treePath.append(treeTexPath); - tree_texture = SGModelLib::findDataFile(treePath.local8BitStr(), options); + tree_texture = SGModelLib::findDataFile(treePath, options); if (tree_texture.empty()) { SG_LOG(SG_GENERAL, SG_ALERT, "Cannot find texture \"" diff --git a/simgear/scene/material/matlib.cxx b/simgear/scene/material/matlib.cxx index 0b40869d..3459d7e0 100644 --- a/simgear/scene/material/matlib.cxx +++ b/simgear/scene/material/matlib.cxx @@ -65,7 +65,7 @@ SGMaterialLib::SGMaterialLib ( void ) : } // Load a library of material properties -bool SGMaterialLib::load( const string &fg_root, const string& mpath, +bool SGMaterialLib::load( const SGPath &fg_root, const SGPath& mpath, SGPropertyNode *prop_root ) { SGPropertyNode materialblocks; @@ -81,7 +81,7 @@ bool SGMaterialLib::load( const string &fg_root, const string& mpath, osg::ref_ptr options = new osgDB::Options; options->setObjectCacheHint(osgDB::Options::CACHE_ALL); - options->setDatabasePath(fg_root); + options->setDatabasePath(fg_root.utf8Str()); simgear::PropertyList blocks = materialblocks.getChildren("region"); simgear::PropertyList::const_iterator block_iter = blocks.begin(); diff --git a/simgear/scene/material/matlib.hxx b/simgear/scene/material/matlib.hxx index 90fb273c..ff80d795 100644 --- a/simgear/scene/material/matlib.hxx +++ b/simgear/scene/material/matlib.hxx @@ -38,6 +38,7 @@ class SGMaterial; class SGPropertyNode; +class SGPath; namespace simgear { class Effect; } namespace osg { class Geode; } @@ -87,7 +88,7 @@ public: SGMaterialLib ( void ); // Load a library of material properties - bool load( const std::string &fg_root, const std::string& mpath, + bool load( const SGPath &fg_root, const SGPath& mpath, SGPropertyNode *prop_root ); // find a material record by material name SGMaterial *find( const std::string& material, SGVec2f center ) const; diff --git a/simgear/scene/model/SGReaderWriterXML.cxx b/simgear/scene/model/SGReaderWriterXML.cxx index b6fc37e9..adb86e41 100644 --- a/simgear/scene/model/SGReaderWriterXML.cxx +++ b/simgear/scene/model/SGReaderWriterXML.cxx @@ -338,12 +338,12 @@ sgLoad3DModel_internal(const SGPath& path, if (!texturepath.extension().empty()) texturepath = texturepath.dir(); - options->setDatabasePath(texturepath.local8BitStr()); + options->setDatabasePath(texturepath.utf8Str()); osgDB::ReaderWriter::ReadResult modelResult; #if OSG_VERSION_LESS_THAN(3,4,1) - modelResult = osgDB::readNodeFile(modelpath.local8BitStr(), options.get()); + modelResult = osgDB::readNodeFile(modelpath.utf8Str(), options.get()); #else - modelResult = osgDB::readRefNodeFile(modelpath.local8BitStr(), options.get()); + modelResult = osgDB::readRefNodeFile(modelpath.utf8Str(), options.get()); #endif if (!modelResult.validNode()) throw sg_io_exception("Failed to load 3D model:" + modelResult.message(), @@ -503,7 +503,7 @@ sgLoad3DModel_internal(const SGPath& path, if (!texturepath.extension().empty()) texturepath = texturepath.dir(); - options2->setDatabasePath(texturepath.local8BitStr()); + options2->setDatabasePath(texturepath.utf8Str()); } group->addChild(Particles::appendParticles(particle_nodes[i], prop_root, @@ -544,7 +544,7 @@ sgLoad3DModel_internal(const SGPath& path, group = static_cast(modelWithEffects.get()); } - simgear::SGTransientModelData modelData(group.get(), prop_root, options.get(), path.local8BitStr()); + simgear::SGTransientModelData modelData(group.get(), prop_root, options.get(), path.utf8Str()); for (unsigned i = 0; i < animation_nodes.size(); ++i) { if (previewMode && animation_nodes[i]->hasChild("nopreview")) { diff --git a/simgear/scene/model/SGText.cxx b/simgear/scene/model/SGText.cxx index 62081f13..d47b5337 100644 --- a/simgear/scene/model/SGText.cxx +++ b/simgear/scene/model/SGText.cxx @@ -97,7 +97,7 @@ osg::Node * SGText::appendText(const SGPropertyNode* configNode, SGPath path("Fonts" ); path.append( configNode->getStringValue( "font", "Helvetica" )); - text->setFont( path.local8BitStr() ); + text->setFont( path.utf8Str() ); text->setCharacterSize(configNode->getDoubleValue("character-size", 1.0 ), configNode->getDoubleValue("character-aspect-ratio", 1.0 )); diff --git a/simgear/scene/model/model.hxx b/simgear/scene/model/model.hxx index 956d329b..4e719527 100644 --- a/simgear/scene/model/model.hxx +++ b/simgear/scene/model/model.hxx @@ -47,7 +47,7 @@ SGLoadTexture2D(const SGPath& path, bool wrapu = true, bool wrapv = true, int mipmaplevels = -1) { - return SGLoadTexture2D(true, path.local8BitStr(), options, wrapu, wrapv, + return SGLoadTexture2D(true, path.utf8Str(), options, wrapu, wrapv, mipmaplevels); } @@ -57,7 +57,7 @@ SGLoadTexture2D(bool staticTexture, const SGPath& path, bool wrapu = true, bool wrapv = true, int mipmaplevels = -1) { - return SGLoadTexture2D(staticTexture, path.local8BitStr(), options, wrapu, wrapv, + return SGLoadTexture2D(staticTexture, path.utf8Str(), options, wrapu, wrapv, mipmaplevels); } diff --git a/simgear/scene/model/modellib.cxx b/simgear/scene/model/modellib.cxx index 92b19196..1dd32459 100644 --- a/simgear/scene/model/modellib.cxx +++ b/simgear/scene/model/modellib.cxx @@ -77,13 +77,27 @@ std::string SGModelLib::findDataFile(const std::string& file, return file; SGPath p = ResourceManager::instance()->findPath(file, currentPath); if (p.exists()) { - return p.local8BitStr(); + return p.utf8Str(); } // finally hand on to standard OSG behaviour return osgDB::findDataFile(file, opts); } +std::string SGModelLib::findDataFile(const SGPath& file, + const osgDB::Options* opts, + SGPath currentPath) +{ + SGPath p = ResourceManager::instance()->findPath(file.utf8Str(), currentPath); + if (p.exists()) { + return p.utf8Str(); + } + + // finally hand on to standard OSG behaviour + return osgDB::findDataFile(file.utf8Str(), opts); +} + + SGModelLib::SGModelLib() { } diff --git a/simgear/scene/model/modellib.hxx b/simgear/scene/model/modellib.hxx index b9be0311..6032bb1e 100644 --- a/simgear/scene/model/modellib.hxx +++ b/simgear/scene/model/modellib.hxx @@ -85,7 +85,11 @@ public: SGModelData *data=0); static std::string findDataFile(const std::string& file, - const osgDB::Options* opts = NULL, + const osgDB::Options* opts = nullptr, + SGPath currentDir = SGPath()); + + static std::string findDataFile(const SGPath& file, + const osgDB::Options* opts = nullptr, SGPath currentDir = SGPath()); protected: SGModelLib(); diff --git a/simgear/scene/sky/cloud.cxx b/simgear/scene/sky/cloud.cxx index 89a964b7..103f7e4e 100644 --- a/simgear/scene/sky/cloud.cxx +++ b/simgear/scene/sky/cloud.cxx @@ -78,7 +78,7 @@ SGMakeState(const SGPath &path, const char* colorTexture, osg::StateSet *stateSet = new osg::StateSet; osg::ref_ptr options; - options = SGReaderWriterOptions::fromPath(path.local8BitStr()); + options = SGReaderWriterOptions::fromPath(path); stateSet->setTextureAttribute(0, SGLoadTexture2D(colorTexture, options.get())); stateSet->setTextureMode(0, GL_TEXTURE_2D, osg::StateAttribute::ON); diff --git a/simgear/scene/sky/moon.cxx b/simgear/scene/sky/moon.cxx index 7f7412d1..d9a1e39c 100644 --- a/simgear/scene/sky/moon.cxx +++ b/simgear/scene/sky/moon.cxx @@ -76,7 +76,7 @@ SGMoon::build( SGPath path, double moon_size ) { // set up the orb state osg::ref_ptr options; - options = SGReaderWriterOptions::fromPath(path.local8BitStr()); + options = SGReaderWriterOptions::fromPath(path); osg::Texture2D* texture = SGLoadTexture2D("moon.png", options.get()); stateSet->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); diff --git a/simgear/scene/sky/newcloud.cxx b/simgear/scene/sky/newcloud.cxx index 8e9eb714..96437427 100644 --- a/simgear/scene/sky/newcloud.cxx +++ b/simgear/scene/sky/newcloud.cxx @@ -118,7 +118,7 @@ SGNewCloud::SGNewCloud(const SGPath &texture_root, const SGPropertyNode *cld_def "image"), texture); ref_ptr options; - options = SGReaderWriterOptions::fromPath(texture_root.local8BitStr()); + options = SGReaderWriterOptions::fromPath(texture_root); effect = makeEffect(pcloudEffect, true, options.get()); if (effect.valid()) { diff --git a/simgear/scene/sky/oursun.cxx b/simgear/scene/sky/oursun.cxx index 1e856f64..43d3e3b2 100644 --- a/simgear/scene/sky/oursun.cxx +++ b/simgear/scene/sky/oursun.cxx @@ -70,7 +70,7 @@ SGSun::build( SGPath path, double sun_size, SGPropertyNode *property_tree_Node ) env_node = property_tree_Node; osg::ref_ptr options; - options = SGReaderWriterOptions::fromPath(path.local8BitStr()); + options = SGReaderWriterOptions::fromPath(path); // build the ssg scene graph sub tree for the sky and connected // into the provide scene graph branch sun_transform = new osg::MatrixTransform; diff --git a/simgear/scene/tgdb/ReaderWriterSTG.cxx b/simgear/scene/tgdb/ReaderWriterSTG.cxx index 73fc9da0..9aff6737 100644 --- a/simgear/scene/tgdb/ReaderWriterSTG.cxx +++ b/simgear/scene/tgdb/ReaderWriterSTG.cxx @@ -276,7 +276,7 @@ struct ReaderWriterSTG::_ModelBin { SGPath path = filePath; path.append(".."); path.append(".."); path.append(".."); - sharedOptions->getDatabasePathList().push_back(path.local8BitStr()); + sharedOptions->getDatabasePathList().push_back(path.utf8Str()); // ensure Models directory synced via TerraSync is searched before the copy in // FG_ROOT, so that updated models can be used. @@ -372,7 +372,7 @@ struct ReaderWriterSTG::_ModelBin { SG_LOG(SG_TERRAIN, SG_INFO, "Loading stg file " << absoluteFileName); - std::string filePath = osgDB::getFilePath(absoluteFileName.local8BitStr()); + std::string filePath = osgDB::getFilePath(absoluteFileName.utf8Str()); // Bucket provides a consistent seed // so we have consistent set of pseudo-random numbers for each STG file @@ -420,7 +420,7 @@ struct ReaderWriterSTG::_ModelBin { _Object obj; obj._errorLocation = absoluteFileName; obj._token = token; - obj._name = path.local8BitStr(); + obj._name = path.utf8Str(); obj._options = staticOptions(filePath, options); _objectList.push_back(obj); } @@ -430,7 +430,7 @@ struct ReaderWriterSTG::_ModelBin { _Object obj; obj._errorLocation = absoluteFileName; obj._token = token; - obj._name = path.local8BitStr(); + obj._name = path.utf8Str(); obj._options = staticOptions(filePath, options); _objectList.push_back(obj); } @@ -537,7 +537,7 @@ struct ReaderWriterSTG::_ModelBin { _objectStaticList.push_back(obj); } else if (token == BUILDING_LIST) { _BuildingList buildinglist; - buildinglist._filename = path.local8BitStr(); + buildinglist._filename = path.utf8Str(); in >> buildinglist._material_name >> buildinglist._lon >> buildinglist._lat >> buildinglist._elev; checkInsideBucket(absoluteFileName, buildinglist._lon, buildinglist._lat); _buildingListList.push_back(buildinglist); diff --git a/simgear/scene/util/SGReaderWriterOptions.cxx b/simgear/scene/util/SGReaderWriterOptions.cxx index 12e32128..8937bd42 100644 --- a/simgear/scene/util/SGReaderWriterOptions.cxx +++ b/simgear/scene/util/SGReaderWriterOptions.cxx @@ -47,10 +47,10 @@ SGReaderWriterOptions::copyOrCreate(const osgDB::Options* options) } SGReaderWriterOptions* -SGReaderWriterOptions::fromPath(const std::string& path) +SGReaderWriterOptions::fromPath(const SGPath& path) { - SGReaderWriterOptions* options = copyOrCreate(0); - options->setDatabasePath(path); + SGReaderWriterOptions* options = copyOrCreate(nullptr); + options->setDatabasePath(path.utf8Str()); return options; } diff --git a/simgear/scene/util/SGReaderWriterOptions.hxx b/simgear/scene/util/SGReaderWriterOptions.hxx index 17183944..940dd761 100644 --- a/simgear/scene/util/SGReaderWriterOptions.hxx +++ b/simgear/scene/util/SGReaderWriterOptions.hxx @@ -31,6 +31,8 @@ #endif class SGPropertyNode; +class SGPath; + typedef std::vector < std::string > string_list; namespace simgear @@ -50,7 +52,6 @@ public: SGReaderWriterOptions() : _materialLib(0), _load_panel(0), - _model_data(0), _instantiateEffects(false), _instantiateMaterialEffects(false), _LoadOriginHint(ORIGIN_MODEL) @@ -59,7 +60,6 @@ public: osgDB::Options(str), _materialLib(0), _load_panel(0), - _model_data(0), _instantiateEffects(false), _instantiateMaterialEffects(false), _LoadOriginHint(ORIGIN_MODEL) @@ -69,7 +69,6 @@ public: osgDB::Options(options, copyop), _materialLib(0), _load_panel(0), - _model_data(0), _instantiateEffects(false), _instantiateMaterialEffects(false), _LoadOriginHint(ORIGIN_MODEL) @@ -144,7 +143,7 @@ public: { _sceneryPathSuffixes = suffixes; } static SGReaderWriterOptions* copyOrCreate(const osgDB::Options* options); - static SGReaderWriterOptions* fromPath(const std::string& path); + static SGReaderWriterOptions* fromPath(const SGPath& path); void setLocation(double lon, double lat) { _geod = SGGeod::fromDeg(lon, lat); } diff --git a/simgear/timing/sg_time.cxx b/simgear/timing/sg_time.cxx index 83b22aec..dc8b6ac0 100644 --- a/simgear/timing/sg_time.cxx +++ b/simgear/timing/sg_time.cxx @@ -222,7 +222,7 @@ void SGTime::update( const SGGeod& location, time_t ct, long int warp ) // Given lon/lat, update timezone information and local_offset -void SGTime::updateLocal( const SGGeod& aLocation, const string& root ) { +void SGTime::updateLocal( const SGGeod& aLocation, const SGPath& root ) { SGGeod location(aLocation); if (!aLocation.isValid()) { location = SGGeod(); diff --git a/simgear/timing/sg_time.hxx b/simgear/timing/sg_time.hxx index 00c058af..0990d0e2 100644 --- a/simgear/timing/sg_time.hxx +++ b/simgear/timing/sg_time.hxx @@ -162,7 +162,7 @@ public: * @param location Current geodetic location * @param root Bbase path containing time zone directory */ - void updateLocal( const SGGeod& location, const std::string& root ); + void updateLocal( const SGGeod& location, const SGPath& root ); /** @return current system/unix time in seconds */ inline time_t get_cur_time() const { return cur_time; };