Aircraft-loading: resolve symlinked dirs earlier.
This is to ensure we pass a realpath when validating Nasal / dialogs, to fix: https://sourceforge.net/p/flightgear/codetickets/2057/
This commit is contained in:
parent
954385ce0d
commit
de0826294c
2 changed files with 7 additions and 5 deletions
|
@ -347,6 +347,7 @@ private:
|
||||||
|
|
||||||
virtual VisitResult visit(const SGPath& p)
|
virtual VisitResult visit(const SGPath& p)
|
||||||
{
|
{
|
||||||
|
SGPath realPath = p.realpath();
|
||||||
// create cache node
|
// create cache node
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -356,17 +357,17 @@ private:
|
||||||
|
|
||||||
SGPropertyNode *n, *entry = _cache->getChild("aircraft", --i, true);
|
SGPropertyNode *n, *entry = _cache->getChild("aircraft", --i, true);
|
||||||
|
|
||||||
std::string fileName(p.file());
|
std::string fileName(realPath.file());
|
||||||
n = entry->getNode("file", true);
|
n = entry->getNode("file", true);
|
||||||
n->setStringValue(fileName);
|
n->setStringValue(fileName);
|
||||||
n->setAttribute(SGPropertyNode::USERARCHIVE, true);
|
n->setAttribute(SGPropertyNode::USERARCHIVE, true);
|
||||||
|
|
||||||
n = entry->getNode("path", true);
|
n = entry->getNode("path", true);
|
||||||
n->setStringValue(p.dir());
|
n->setStringValue(realPath.dir());
|
||||||
n->setAttribute(SGPropertyNode::USERARCHIVE, true);
|
n->setAttribute(SGPropertyNode::USERARCHIVE, true);
|
||||||
|
|
||||||
if (simgear::strutils::iequals(fileName, _searchAircraft)) {
|
if (simgear::strutils::iequals(fileName, _searchAircraft)) {
|
||||||
_foundPath = p;
|
_foundPath = realPath;
|
||||||
return VISIT_DONE;
|
return VISIT_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2251,7 +2251,8 @@ void Options::initAircraft()
|
||||||
|
|
||||||
if (isOptionSet("aircraft-dir")) {
|
if (isOptionSet("aircraft-dir")) {
|
||||||
SGPath aircraftDirPath = SGPath::fromUtf8(valueForOption("aircraft-dir"));
|
SGPath aircraftDirPath = SGPath::fromUtf8(valueForOption("aircraft-dir"));
|
||||||
globals->append_read_allowed_paths(aircraftDirPath);
|
SGPath realAircraftPath = aircraftDirPath.realpath();
|
||||||
|
globals->append_read_allowed_paths(realAircraftPath);
|
||||||
|
|
||||||
// Set this now, so it's available in FindAndCacheAircraft. Use realpath()
|
// Set this now, so it's available in FindAndCacheAircraft. Use realpath()
|
||||||
// as in FGGlobals::append_aircraft_path(), otherwise fgValidatePath()
|
// as in FGGlobals::append_aircraft_path(), otherwise fgValidatePath()
|
||||||
|
@ -2259,7 +2260,7 @@ void Options::initAircraft()
|
||||||
// is a symlink (which is not a problem, since it was given as is by the
|
// 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
|
// user---this is very different from a symlink *under* the aircraft dir
|
||||||
// or a scenery dir).
|
// or a scenery dir).
|
||||||
fgSetString("/sim/aircraft-dir", aircraftDirPath.realpath().utf8Str());
|
fgSetString("/sim/aircraft-dir", realAircraftPath.utf8Str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isOptionSet("state")) {
|
if (isOptionSet("state")) {
|
||||||
|
|
Loading…
Reference in a new issue