From: James Turner Date: Tue, 21 Jun 2016 11:28:35 +0000 (+0100) Subject: Work with new SGPath API. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=31755c51ed0fbe076ade61bd36c0b875deed69c6;p=flightgear.git Work with new SGPath API. --- diff --git a/src/AIModel/AIFlightPlan.cxx b/src/AIModel/AIFlightPlan.cxx index d99172274..7d1c6ae66 100644 --- a/src/AIModel/AIFlightPlan.cxx +++ b/src/AIModel/AIFlightPlan.cxx @@ -234,9 +234,9 @@ bool FGAIFlightPlan::parseProperties(const std::string& filename) SGPropertyNode root; try { - readProperties(path.str(), &root); + readProperties(path, &root); } catch (const sg_exception &e) { - SG_LOG(SG_AI, SG_ALERT, "Error reading AI flight plan: " << path.str() + SG_LOG(SG_AI, SG_ALERT, "Error reading AI flight plan: " << path << "message:" << e.getFormattedMessage()); return false; } diff --git a/src/AIModel/AIManager.cxx b/src/AIModel/AIManager.cxx index 4faf23e59..fe9e4ee13 100644 --- a/src/AIModel/AIManager.cxx +++ b/src/AIModel/AIManager.cxx @@ -507,11 +507,11 @@ FGAIManager::loadScenarioFile(const std::string& filename) path.append("AI/" + filename + ".xml"); try { SGPropertyNode_ptr root = new SGPropertyNode; - readProperties(path.str(), root); + readProperties(path, root); return root; } catch (const sg_exception &t) { SG_LOG(SG_AI, SG_ALERT, "Failed to load scenario '" - << path.str() << "': " << t.getFormattedMessage()); + << path << "': " << t.getFormattedMessage()); } return 0; } diff --git a/src/AIModel/performancedb.cxx b/src/AIModel/performancedb.cxx index 3a8ce5459..7b01e86fe 100644 --- a/src/AIModel/performancedb.cxx +++ b/src/AIModel/performancedb.cxx @@ -111,10 +111,10 @@ void PerformanceDB::load(const SGPath& filename) { SGPropertyNode root; try { - readProperties(filename.str(), &root); + readProperties(filename, &root); } catch (const sg_exception &) { SG_LOG(SG_AI, SG_ALERT, - "Error reading AI aircraft performance database: " << filename.str()); + "Error reading AI aircraft performance database: " << filename); return; } diff --git a/src/AIModel/submodel.cxx b/src/AIModel/submodel.cxx index b3000f9a3..249fe1ade 100644 --- a/src/AIModel/submodel.cxx +++ b/src/AIModel/submodel.cxx @@ -484,12 +484,12 @@ void FGSubmodelMgr::setData(int id, const string& path, bool serviceable, const SGPath config = globals->resolve_aircraft_path(path); try { SG_LOG(SG_AI, SG_DEBUG, - "Submodels: Trying to read AI submodels file: " << config.str()); - readProperties(config.str(), &root); + "Submodels: Trying to read AI submodels file: " << config); + readProperties(config, &root); } catch (const sg_exception &) { SG_LOG(SG_AI, SG_ALERT, - "Submodels: Unable to read AI submodels file: " << config.str()); + "Submodels: Unable to read AI submodels file: " << config); return; } diff --git a/src/ATC/ATISEncoder.cxx b/src/ATC/ATISEncoder.cxx index 294bb8306..256166cd7 100644 --- a/src/ATC/ATISEncoder.cxx +++ b/src/ATC/ATISEncoder.cxx @@ -193,7 +193,7 @@ string ATISEncoder::encodeATIS( ATISInformationProvider * atisInformation ) try { SGPath path = globals->resolve_maybe_aircraft_path("ATC/atis.xml"); - readProperties( path.str(), atisSchemaNode ); + readProperties( path, atisSchemaNode ); } catch (const sg_exception& e) { diff --git a/src/Aircraft/flightrecorder.cxx b/src/Aircraft/flightrecorder.cxx index 34a03c18d..075ba17a3 100644 --- a/src/Aircraft/flightrecorder.cxx +++ b/src/Aircraft/flightrecorder.cxx @@ -180,7 +180,7 @@ FGFlightRecorder::getDefault(void) { try { - readProperties(path.str(), m_RecorderNode->getChild("config", 0 ,true), 0); + readProperties(path, m_RecorderNode->getChild("config", 0 ,true), 0); ConfigNode = m_RecorderNode->getChild("config", 0 ,false); } catch (sg_io_exception &e) { diff --git a/src/Airports/airport.cxx b/src/Airports/airport.cxx index 879f3f224..c8be10102 100644 --- a/src/Airports/airport.cxx +++ b/src/Airports/airport.cxx @@ -564,7 +564,7 @@ void FGAirport::loadProcedures() const return; } - SG_LOG(SG_GENERAL, SG_INFO, ident() << ": loading procedures from " << path.str()); + SG_LOG(SG_GENERAL, SG_INFO, ident() << ": loading procedures from " << path); RouteBase::loadAirportProcedures(path, const_cast(this)); } @@ -583,7 +583,7 @@ void FGAirport::loadSceneryDefinitions() const try { SGPropertyNode_ptr rootNode = new SGPropertyNode; - readProperties(path.str(), rootNode); + readProperties(path, rootNode); const_cast(this)->readThresholdData(rootNode); } catch (sg_exception& e) { SG_LOG(SG_NAVAID, SG_WARN, ident() << "loading threshold XML failed:" << e.getFormattedMessage()); @@ -691,7 +691,7 @@ void FGAirport::validateTowerData() const try { SGPropertyNode_ptr rootNode = new SGPropertyNode; - readProperties(path.str(), rootNode); + readProperties(path, rootNode); const_cast(this)->readTowerData(rootNode); mHasTower = true; } catch (sg_exception& e){ @@ -729,7 +729,7 @@ void FGAirport::validateILSData() try { SGPropertyNode_ptr rootNode = new SGPropertyNode; - readProperties(path.str(), rootNode); + readProperties(path, rootNode); readILSData(rootNode); } catch (sg_exception& e){ SG_LOG(SG_NAVAID, SG_WARN, ident() << "loading ils XML failed:" << e.getFormattedMessage()); diff --git a/src/Airports/apt_loader.cxx b/src/Airports/apt_loader.cxx index 0dd3512b4..781a078f0 100644 --- a/src/Airports/apt_loader.cxx +++ b/src/Airports/apt_loader.cxx @@ -89,12 +89,11 @@ public: void parseAPT(const SGPath &aptdb_file) { - std::string apt_dat = aptdb_file.str(); - sg_gzifstream in(apt_dat); + sg_gzifstream in(aptdb_file); if ( !in.is_open() ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << apt_dat ); - throw sg_io_exception("cannot open apt.dat file", apt_dat.c_str()); + SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << aptdb_file ); + throw sg_io_exception("cannot open apt.dat file", aptdb_file); } string line; @@ -113,9 +112,8 @@ public: // First line indicates IBM ("I") or Macintosh ("A") line endings. if ( stripped_line != "I" && stripped_line != "A" ) { std::string pb = "invalid first line (neither 'I' nor 'A')"; - SG_LOG( SG_GENERAL, SG_ALERT, apt_dat << ": " << pb); - throw sg_format_exception("cannot parse apt.dat file: " + pb, - apt_dat); + SG_LOG( SG_GENERAL, SG_ALERT, aptdb_file << ": " << pb); + throw sg_format_exception("cannot parse apt.dat file: " + pb, aptdb_file.utf8Str()); } } else { // second line of the file std::istringstream s(line); @@ -126,7 +124,7 @@ public: } } // end of the apt.dat header - throwExceptionIfStreamError(in, "apt.dat", apt_dat); + throwExceptionIfStreamError(in, "apt.dat", aptdb_file.utf8Str()); while ( std::getline(in, line) ) { // 'line' may end with an \r character, see above @@ -202,7 +200,7 @@ public: } } - throwExceptionIfStreamError(in, "apt.dat", apt_dat); + throwExceptionIfStreamError(in, "apt.dat", aptdb_file.utf8Str()); finishAirport(); } @@ -569,7 +567,7 @@ bool airportDBLoad( const SGPath &aptdb_file ) bool metarDataLoad(const SGPath& metar_file) { - sg_gzifstream metar_in( metar_file.str() ); + sg_gzifstream metar_in( metar_file ); if ( !metar_in.is_open() ) { SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << metar_file ); return false; diff --git a/src/Airports/sidstar.cxx b/src/Airports/sidstar.cxx index af7a020c9..22aa32179 100644 --- a/src/Airports/sidstar.cxx +++ b/src/Airports/sidstar.cxx @@ -52,10 +52,10 @@ void FGSidStar::load(SGPath filename) { string runway; string name; try { - readProperties(filename.str(), &root); + readProperties(filename, &root); } catch (const sg_exception &) { SG_LOG(SG_GENERAL, SG_ALERT, - "Error reading AI flight plan: " << filename.str()); + "Error reading AI flight plan: " << filename); // cout << path.str() << endl; return; } diff --git a/src/Airports/xmlloader.cxx b/src/Airports/xmlloader.cxx index 9bbc3e750..dc24ec6c1 100644 --- a/src/Airports/xmlloader.cxx +++ b/src/Airports/xmlloader.cxx @@ -54,7 +54,7 @@ void XMLLoader::load(FGGroundNetwork* net) t.stamp(); try { FGGroundNetXMLLoader visitor(net); - readXML(path.str(), visitor); + readXML(path.local8BitStr(), visitor); } catch (sg_exception& e) { SG_LOG(SG_NAVAID, SG_INFO, "parsing groundnet XML failed:" << e.getFormattedMessage()); } @@ -105,8 +105,8 @@ bool XMLLoader::loadAirportXMLDataIntoVisitor(const string& aICAO, return false; } - SG_LOG(SG_GENERAL, SG_DEBUG, "loadAirportXMLDataIntoVisitor: loading from " << path.str()); - readXML(path.str(), aVisitor); + SG_LOG(SG_GENERAL, SG_DEBUG, "loadAirportXMLDataIntoVisitor: loading from " << path); + readXML(path.local8BitStr(), aVisitor); return true; } diff --git a/src/Autopilot/autopilotgroup.cxx b/src/Autopilot/autopilotgroup.cxx index 199a14b94..ada473cb5 100644 --- a/src/Autopilot/autopilotgroup.cxx +++ b/src/Autopilot/autopilotgroup.cxx @@ -197,13 +197,13 @@ void FGXMLAutopilotGroup::addAutopilotFromFile( const std::string& name, ( SG_AUTOPILOT, SG_INFO, - "Reading property-rule configuration from " << config.str() + "Reading property-rule configuration from " << config ); try { SGPropertyNode_ptr configNode = new SGPropertyNode(); - readProperties( config.str(), configNode ); + readProperties( config, configNode ); SG_LOG(SG_AUTOPILOT, SG_INFO, "adding property-rule subsystem " << name); addAutopilot(name, apNode, configNode); @@ -214,7 +214,7 @@ void FGXMLAutopilotGroup::addAutopilotFromFile( const std::string& name, ( SG_AUTOPILOT, SG_ALERT, - "Failed to load property-rule configuration: " << config.str() + "Failed to load property-rule configuration: " << config << ": " << e.getMessage() ); return; diff --git a/src/Autopilot/route_mgr.cxx b/src/Autopilot/route_mgr.cxx index f58c57ac4..bae5b1d23 100644 --- a/src/Autopilot/route_mgr.cxx +++ b/src/Autopilot/route_mgr.cxx @@ -359,7 +359,7 @@ void FGRouteMgr::postinit() SGPath path(_pathNode->getStringValue()); if (!path.isNull()) { - SG_LOG(SG_AUTOPILOT, SG_INFO, "loading flight-plan from: " << path.str()); + SG_LOG(SG_AUTOPILOT, SG_INFO, "loading flight-plan from: " << path); loadRoute(path); } diff --git a/src/Canvas/FGCanvasSystemAdapter.cxx b/src/Canvas/FGCanvasSystemAdapter.cxx index 894ca0bdc..f31ab12cf 100644 --- a/src/Canvas/FGCanvasSystemAdapter.cxx +++ b/src/Canvas/FGCanvasSystemAdapter.cxx @@ -48,16 +48,16 @@ namespace canvas ( SG_GL, SG_INFO, - "canvas::Text: using font file " << path.str() + "canvas::Text: using font file " << path ); - simgear::canvas::FontPtr font = osgText::readFontFile(path.c_str()); + simgear::canvas::FontPtr font = osgText::readFontFile(path.local8BitStr()); if( !font ) SG_LOG ( SG_GL, SG_ALERT, - "canvas::Text: Failed to open font file " << path.c_str() + "canvas::Text: Failed to open font file " << path ); return font; diff --git a/src/Cockpit/cockpitDisplayManager.cxx b/src/Cockpit/cockpitDisplayManager.cxx index 18e6e7d8a..4c6d338f1 100644 --- a/src/Cockpit/cockpitDisplayManager.cxx +++ b/src/Cockpit/cockpitDisplayManager.cxx @@ -65,10 +65,10 @@ void CockpitDisplayManager::init() } SGPath config = globals->resolve_aircraft_path(path_n->getStringValue()); - SG_LOG( SG_COCKPIT, SG_INFO, "Reading cockpit displays from " << config.str() ); + SG_LOG( SG_COCKPIT, SG_INFO, "Reading cockpit displays from " << config ); try { - readProperties( config.str(), config_props ); + readProperties( config, config_props ); if (!build(config_props)) { throw sg_exception( "Detected an internal inconsistency in the instrumentation\n" @@ -76,7 +76,7 @@ void CockpitDisplayManager::init() } } catch (const sg_exception& e) { SG_LOG(SG_COCKPIT, SG_ALERT, "Failed to load instrumentation system model: " - << config.str() << ":" << e.getFormattedMessage() ); + << config << ":" << e.getFormattedMessage() ); } // bind() created instruments before init. diff --git a/src/Cockpit/panel_io.cxx b/src/Cockpit/panel_io.cxx index f05d057f1..cb12f5a7d 100644 --- a/src/Cockpit/panel_io.cxx +++ b/src/Cockpit/panel_io.cxx @@ -844,7 +844,7 @@ fgReadPanel (const string &relative_path) SGPropertyNode root; try { - readProperties(path.str(), &root); + readProperties(path, &root); } catch (const sg_exception &e) { guiErrorMessage("Error reading panel: ", e); return 0; diff --git a/src/FDM/JSBSim/JSBSim.cxx b/src/FDM/JSBSim/JSBSim.cxx index b94a900a8..d825a4262 100644 --- a/src/FDM/JSBSim/JSBSim.cxx +++ b/src/FDM/JSBSim/JSBSim.cxx @@ -233,9 +233,9 @@ FGJSBsim::FGJSBsim( double dt ) fdmex->Setdt( dt ); - result = fdmex->LoadModel( aircraft_path.str(), - engine_path.str(), - systems_path.str(), + result = fdmex->LoadModel( aircraft_path.local8BitStr(), + engine_path.local8BitStr(), + systems_path.local8BitStr(), fgGetString("/sim/aero"), false ); if (result) { diff --git a/src/FDM/UIUCModel/uiuc_wrapper.cpp b/src/FDM/UIUCModel/uiuc_wrapper.cpp index fd3fcf8ea..297c0e6b2 100644 --- a/src/FDM/UIUCModel/uiuc_wrapper.cpp +++ b/src/FDM/UIUCModel/uiuc_wrapper.cpp @@ -321,9 +321,9 @@ void uiuc_init_aeromodel () // Called once from uiuc_init_2_wrapper SGPath path(fgGetString("/sim/aircraft-dir")); path.append("aircraft.dat"); - std::cout << "We are using "<< path.str() << std::endl; + std::cout << "We are using "<< path << std::endl; uiuc_initializemaps(); // Initialize the maps - uiuc_menu(path.str()); // Read the specified aircraft file + uiuc_menu(path.local8BitStr()); // Read the specified aircraft file } void uiuc_force_moment(double dt) diff --git a/src/FDM/YASim/YASim.cxx b/src/FDM/YASim/YASim.cxx index 07163676a..22073380a 100644 --- a/src/FDM/YASim/YASim.cxx +++ b/src/FDM/YASim/YASim.cxx @@ -170,10 +170,10 @@ void YASim::init() f.append(fgGetString("/sim/aero")); f.concat(".xml"); try { - readXML(f.str(), *_fdm); + readXML(f.local8BitStr(), *_fdm); } catch (const sg_exception &e) { SG_LOG(SG_FLIGHT, SG_ALERT, - "Error reading YASim FDM: '" << f.str() << "'" << std::endl + "Error reading YASim FDM: '" << f << "'" << std::endl << e.getFormattedMessage()); throw e; } diff --git a/src/GUI/AircraftModel.cxx b/src/GUI/AircraftModel.cxx index 5783a1237..774608d1c 100644 --- a/src/GUI/AircraftModel.cxx +++ b/src/GUI/AircraftModel.cxx @@ -522,7 +522,7 @@ void AircraftItemModel::scanDirs() SGPath rootAircraft(globals->get_fg_root()); rootAircraft.append("Aircraft"); - dirs << QString::fromStdString(rootAircraft.str()); + dirs << QString::fromStdString(rootAircraft.utf8Str()); m_scanThread = new AircraftScanThread(dirs); connect(m_scanThread, &AircraftScanThread::finished, this, @@ -713,7 +713,7 @@ QVariant AircraftItemModel::dataFromPackage(const PackageRef& item, quint32 vari } else if (role == AircraftPathRole) { InstallRef i = item->existingInstall(); if (i.valid()) { - return QString::fromStdString(i->primarySetPath().str()); + return QString::fromStdString(i->primarySetPath().utf8Str()); } } else if (role == AircraftPackageIdRole) { return QString::fromStdString(item->variants()[variantIndex]); @@ -794,7 +794,7 @@ QVariant AircraftItemModel::packageThumbnail(PackageRef p, int index, bool downl path.append(p->thumbnails()[index]); if (path.exists()) { QPixmap pix; - pix.load(QString::fromStdString(path.str())); + pix.load(QString::fromStdString(path.utf8Str())); // resize to the standard size if (pix.height() > STANDARD_THUMBNAIL_HEIGHT) { pix = pix.scaledToHeight(STANDARD_THUMBNAIL_HEIGHT); diff --git a/src/GUI/CocoaHelpers.mm b/src/GUI/CocoaHelpers.mm index 493e9458f..126b17c21 100644 --- a/src/GUI/CocoaHelpers.mm +++ b/src/GUI/CocoaHelpers.mm @@ -52,7 +52,7 @@ std::string stdStringFromCocoa(NSString* s) NSURL* pathToNSURL(const SGPath& aPath) { - return [NSURL fileURLWithPath:stdStringToCocoa(aPath.str())]; + return [NSURL fileURLWithPath:stdStringToCocoa(aPath.utf8Str())]; } SGPath URLToPath(NSURL* url) diff --git a/src/GUI/QtFileDialog.cxx b/src/GUI/QtFileDialog.cxx index 5d140db91..effae6650 100644 --- a/src/GUI/QtFileDialog.cxx +++ b/src/GUI/QtFileDialog.cxx @@ -52,7 +52,7 @@ void QtFileDialog::exec() } filter=filter+*it; } - QFileDialog dlg(0,QString::fromStdString(_title),QString::fromStdString(_initialPath.str()),QString::fromStdString(filter)); + QFileDialog dlg(0,QString::fromStdString(_title),QString::fromStdString(_initialPath.utf8Str()),QString::fromStdString(filter)); if (_usage==USE_SAVE_FILE) { dlg.setAcceptMode(QFileDialog::AcceptSave); } diff --git a/src/GUI/QtLauncher.cxx b/src/GUI/QtLauncher.cxx index 8e74eb257..f407f43fc 100644 --- a/src/GUI/QtLauncher.cxx +++ b/src/GUI/QtLauncher.cxx @@ -655,7 +655,7 @@ void QtLauncher::setSceneryPaths() SGPath terraSyncDir(downloadDir.toStdString()); terraSyncDir.append("TerraSync"); if (terraSyncDir.exists()) { - globals->append_fg_scenery(terraSyncDir.str()); + globals->append_fg_scenery(terraSyncDir.utf8Str()); } } diff --git a/src/Input/fgjs.cxx b/src/Input/fgjs.cxx index d849f3ce6..76a20b37f 100644 --- a/src/Input/fgjs.cxx +++ b/src/Input/fgjs.cxx @@ -136,7 +136,7 @@ int main( int argc, char *argv[] ) { SGPropertyNode *templatetree = new SGPropertyNode(); try { - readProperties(templatefile.str().c_str(), templatetree); + readProperties(templatefile, templatetree); } catch (sg_io_exception & e) { cout << e.getFormattedMessage (); } diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index 1e93a0b7b..98ea4b67c 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -1162,7 +1162,7 @@ do_load_xml_to_proptree(const SGPropertyNode * arg) targetnode = const_cast(arg)->getNode("data", true); try { - readProperties(validated_path.c_str(), targetnode, true); + readProperties(validated_path, targetnode, true); } catch (const sg_exception &e) { SG_LOG(SG_IO, SG_WARN, "loadxml: " << e.getFormattedMessage()); return false; @@ -1247,7 +1247,7 @@ do_save_xml_from_proptree(const SGPropertyNode * arg) return false; try { - writeProperties (validated_path.c_str(), sourcenode, true); + writeProperties (validated_path, sourcenode, true); } catch (const sg_exception &e) { SG_LOG(SG_IO, SG_WARN, "savexml: " << e.getFormattedMessage()); return false; diff --git a/src/Navaids/FlightPlan.cxx b/src/Navaids/FlightPlan.cxx index 89e1f5f41..926688e65 100644 --- a/src/Navaids/FlightPlan.cxx +++ b/src/Navaids/FlightPlan.cxx @@ -922,7 +922,7 @@ WayptRef FlightPlan::parseVersion1XMLWaypt(SGPropertyNode* aWP) bool FlightPlan::loadPlainTextFormat(const SGPath& path) { try { - sg_gzifstream in(path.str().c_str()); + sg_gzifstream in(path); if (!in.is_open()) { throw sg_io_exception("Cannot open file for reading."); } diff --git a/src/Navaids/NavDataCache.cxx b/src/Navaids/NavDataCache.cxx index ea83e861d..99894a0fb 100644 --- a/src/Navaids/NavDataCache.cxx +++ b/src/Navaids/NavDataCache.cxx @@ -263,7 +263,7 @@ public: SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE; // see http://code.google.com/p/flightgear-bugs/issues/detail?id=1055 // for the UTF8 / path logic here - std::string pathUtf8 = simgear::strutils::convertWindowsLocal8BitToUtf8(path.str()); + std::string pathUtf8 = path.utf8Str(); sqlite3_open_v2(pathUtf8.c_str(), &db, openFlags, NULL); sqlite3_stmt_ptr checkTables = @@ -978,10 +978,10 @@ FGPositioned* NavDataCache::NavDataCachePrivate::loadById(sqlite3_int64 rowid, bool NavDataCache::NavDataCachePrivate::isCachedFileModified(const SGPath& path, bool verbose) { if (!path.exists()) { - throw sg_io_exception("isCachedFileModified: Missing file:" + path.str()); + throw sg_io_exception("isCachedFileModified: Missing file:", path); } - sqlite_bind_temp_stdstring(statCacheCheck, 1, path.str()); + sqlite_bind_temp_stdstring(statCacheCheck, 1, path.utf8Str()); bool isModified = true; sgDebugPriority logLevel = verbose ? SG_WARN : SG_DEBUG; if (execSelect(statCacheCheck)) { @@ -1336,7 +1336,7 @@ bool NavDataCache::isCachedFileModified(const SGPath& path) const void NavDataCache::stampCacheFile(const SGPath& path) { - sqlite_bind_temp_stdstring(d->stampFileCache, 1, path.str()); + sqlite_bind_temp_stdstring(d->stampFileCache, 1, path.utf8Str()); sqlite3_bind_int64(d->stampFileCache, 2, path.modTime()); d->execInsert(d->stampFileCache); } @@ -2142,7 +2142,7 @@ NavDataCache::ThreadedGUISearch::ThreadedGUISearch(const std::string& term) : { SGPath p = NavDataCache::instance()->path(); int openFlags = SQLITE_OPEN_READONLY; - std::string pathUtf8 = simgear::strutils::convertWindowsLocal8BitToUtf8(p.str()); + std::string pathUtf8 = p.utf8Str(); sqlite3_open_v2(pathUtf8.c_str(), &d->db, openFlags, NULL); std::string sql = "SELECT rowid FROM positioned WHERE name LIKE '%" + term diff --git a/utils/GPSsmooth/GPSsmooth.cxx b/utils/GPSsmooth/GPSsmooth.cxx index c3ddde99e..3196fa9f8 100644 --- a/utils/GPSsmooth/GPSsmooth.cxx +++ b/utils/GPSsmooth/GPSsmooth.cxx @@ -9,6 +9,7 @@ #include #include #include +#include #include "GPSsmooth.hxx" @@ -27,7 +28,7 @@ int GPSTrack::load( const string &file ) { data.clear(); // openg the file - sg_gzifstream in( file ); + sg_gzifstream in( SGPath::fromLocal8Bit(file.c_str()) ); if ( !in.is_open() ) { cout << "Cannot open file: " << file << endl; return 0;