Search the current aircraft-dir implicitly.
If a file is specified without an 'Aircraft/subdir' prefix, check for it relative to the the current aircraft dir.
This commit is contained in:
parent
18506d3e65
commit
1c8d9ef132
1 changed files with 19 additions and 1 deletions
|
@ -106,6 +106,23 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class CurrentAircraftDirProvider : public simgear::ResourceProvider
|
||||
{
|
||||
public:
|
||||
CurrentAircraftDirProvider() :
|
||||
simgear::ResourceProvider(simgear::ResourceManager::PRIORITY_HIGH)
|
||||
{
|
||||
}
|
||||
|
||||
virtual SGPath resolve(const std::string& aResource, SGPath&) const
|
||||
{
|
||||
const char* aircraftDir = fgGetString("/sim/aircraft-dir");
|
||||
SGPath p(aircraftDir);
|
||||
p.append(aResource);
|
||||
return p.exists() ? p : SGPath();
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of FGGlobals.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -141,7 +158,8 @@ FGGlobals::FGGlobals() :
|
|||
channellist( NULL ),
|
||||
haveUserSettings(false)
|
||||
{
|
||||
simgear::ResourceManager::instance()->addProvider(new AircraftResourceProvider());
|
||||
simgear::ResourceManager::instance()->addProvider(new AircraftResourceProvider);
|
||||
simgear::ResourceManager::instance()->addProvider(new CurrentAircraftDirProvider);
|
||||
simgear::PropertyObjectBase::setDefaultRoot(props);
|
||||
|
||||
positionLon = props->getNode("position/longitude-deg", true);
|
||||
|
|
Loading…
Add table
Reference in a new issue