From: James Turner Date: Mon, 4 Jul 2016 08:06:42 +0000 (+0100) Subject: Update for changed SGPath::realpath signature X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0c00cd3c6d34e4e167457897a274864cb7236da6;p=flightgear.git Update for changed SGPath::realpath signature --- diff --git a/src/Main/options.cxx b/src/Main/options.cxx index ffacd45bb..3ac5d2eec 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -2084,7 +2084,7 @@ void Options::initAircraft() // is a symlink (which is not a problem, since it was given as is by the // user---this is very different from a symlink *under* the aircraft dir // or a scenery dir). - fgSetString("/sim/aircraft-dir", aircraftDirPath.realpath().c_str()); + fgSetString("/sim/aircraft-dir", aircraftDirPath.realpath().utf8Str()); } if (isOptionSet("state")) { diff --git a/src/Main/util.cxx b/src/Main/util.cxx index 616bbdcd1..685e34d59 100644 --- a/src/Main/util.cxx +++ b/src/Main/util.cxx @@ -81,7 +81,7 @@ static string_list write_allowed_paths; */ void fgInitAllowedPaths() { - if(SGPath("ygjmyfvhhnvdoesnotexist").realpath() == "ygjmyfvhhnvdoesnotexist"){ + if(SGPath("ygjmyfvhhnvdoesnotexist").realpath().utf8Str() == "ygjmyfvhhnvdoesnotexist"){ // Forbid using this version of fgValidatePath() with older // (not normalizing non-existent files) versions of realpath(), // as that would be a security hole @@ -92,8 +92,8 @@ void fgInitAllowedPaths() } read_allowed_paths.clear(); write_allowed_paths.clear(); - std::string fg_root = globals->get_fg_root().realpath(); - std::string fg_home = globals->get_fg_home().realpath(); + std::string fg_root = globals->get_fg_root().realpath().utf8Str(); + std::string fg_home = globals->get_fg_home().realpath().utf8Str(); #if defined(_MSC_VER) /*for MS compilers */ || defined(_WIN32) /*needed for non MS windows compilers like MingW*/ std::string sep = "\\"; #else @@ -122,8 +122,8 @@ void fgInitAllowedPaths() "or fgInitAllowedPaths() called too early"); exit(-1); } - read_allowed_paths.push_back(it->realpath() + sep + "*"); - read_allowed_paths.push_back(it->realpath()); + read_allowed_paths.push_back(it->realpath().utf8Str() + sep + "*"); + read_allowed_paths.push_back(it->realpath().utf8Str()); } write_allowed_paths.push_back(fg_home + sep + "*.sav"); @@ -162,7 +162,7 @@ void fgInitAllowedPaths() SGPath fgValidatePath (const SGPath& path, bool write) { // Normalize the path (prevents ../../.. or symlink trickery) - std::string normed_path = path.realpath(); + std::string normed_path = path.realpath().utf8Str(); const string_list& allowed_paths(write ? write_allowed_paths : read_allowed_paths); size_t star_pos;