stop using /sim/terrasync/scenery-dir, fix scenery path order
Having non-Nasal-readable scenery paths breaks things (The property continues to exist, but is now from-C++-to-Nasal only)
This commit is contained in:
parent
57402dec1b
commit
3b1f01c49d
6 changed files with 31 additions and 8 deletions
|
@ -1347,7 +1347,7 @@ do_set_scenery_paths(const SGPropertyNode* arg)
|
||||||
{
|
{
|
||||||
globals->clear_fg_scenery();
|
globals->clear_fg_scenery();
|
||||||
|
|
||||||
std::string terrasyncPath(fgGetString("/sim/terrasync/scenery-dir"));
|
std::string terrasyncPath(globals->get_terrasync_dir().local8BitStr());
|
||||||
bool seenTerrasyncPath = false;
|
bool seenTerrasyncPath = false;
|
||||||
|
|
||||||
simgear::PropertyList paths = arg->getChildren("path");
|
simgear::PropertyList paths = arg->getChildren("path");
|
||||||
|
|
|
@ -418,6 +418,25 @@ void FGGlobals::clear_fg_scenery()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FGGlobals::set_terrasync_dir(const SGPath &path)
|
||||||
|
{
|
||||||
|
if (terrasync_dir.realpath() != SGPath(fgGetString("/sim/terrasync/scenery-dir")).realpath()) {
|
||||||
|
// if they don't match, /sim/terrasync/scenery-dir has been set by something else
|
||||||
|
SG_LOG(SG_GENERAL, SG_ALERT, "/sim/terrasync/scenery-dir is no longer stored across runs: if you wish to keep using a non-standard Terrasync directory, use --terrasync-dir or the launcher's settings");
|
||||||
|
}
|
||||||
|
SGPath abspath(path.realpath());
|
||||||
|
terrasync_dir = abspath;
|
||||||
|
// deliberately not a tied property, for fgValidatePath security
|
||||||
|
// write-protect to avoid accidents
|
||||||
|
SGPropertyNode *n = fgGetNode("/sim/terrasync/scenery-dir", true);
|
||||||
|
n->setAttribute(SGPropertyNode::WRITE, true);
|
||||||
|
n->setStringValue(abspath.utf8Str());
|
||||||
|
n->setAttribute(SGPropertyNode::WRITE, false);
|
||||||
|
// don't add it to fg_scenery yet, as we want it ordered after explicit --fg-scenery
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FGGlobals::set_catalog_aircraft_path(const SGPath& path)
|
void FGGlobals::set_catalog_aircraft_path(const SGPath& path)
|
||||||
{
|
{
|
||||||
catalog_aircraft_dir = path;
|
catalog_aircraft_dir = path;
|
||||||
|
|
|
@ -104,6 +104,8 @@ private:
|
||||||
|
|
||||||
// Users home directory for data
|
// Users home directory for data
|
||||||
SGPath fg_home;
|
SGPath fg_home;
|
||||||
|
//Terrasync directory
|
||||||
|
SGPath terrasync_dir;
|
||||||
|
|
||||||
// Roots of FlightGear scenery tree
|
// Roots of FlightGear scenery tree
|
||||||
PathList fg_scenery;
|
PathList fg_scenery;
|
||||||
|
@ -219,6 +221,9 @@ public:
|
||||||
const SGPath &get_fg_home () const { return fg_home; }
|
const SGPath &get_fg_home () const { return fg_home; }
|
||||||
void set_fg_home (const SGPath &home);
|
void set_fg_home (const SGPath &home);
|
||||||
|
|
||||||
|
const SGPath &get_terrasync_dir () const { return terrasync_dir; }
|
||||||
|
void set_terrasync_dir (const SGPath &path);
|
||||||
|
|
||||||
const PathList &get_fg_scenery () const { return fg_scenery; }
|
const PathList &get_fg_scenery () const { return fg_scenery; }
|
||||||
const PathList &get_unmangled_fg_scenery () const { return unmangled_fg_scenery; }
|
const PathList &get_unmangled_fg_scenery () const { return unmangled_fg_scenery; }
|
||||||
const PathList &get_extra_read_allowed_paths () const { return extra_read_allowed_paths; }
|
const PathList &get_extra_read_allowed_paths () const { return extra_read_allowed_paths; }
|
||||||
|
|
|
@ -125,7 +125,7 @@ static void initTerrasync()
|
||||||
{
|
{
|
||||||
// add the terrasync root as a data path so data can be retrieved from it
|
// add the terrasync root as a data path so data can be retrieved from it
|
||||||
// (even if we are in read-only mode)
|
// (even if we are in read-only mode)
|
||||||
std::string terraSyncDir(fgGetString("/sim/terrasync/scenery-dir"));
|
SGPath terraSyncDir(globals->get_terrasync_dir());
|
||||||
globals->append_data_path(terraSyncDir);
|
globals->append_data_path(terraSyncDir);
|
||||||
|
|
||||||
if (fgGetBool("/sim/fghome-readonly", false)) {
|
if (fgGetBool("/sim/fghome-readonly", false)) {
|
||||||
|
|
|
@ -860,8 +860,7 @@ static int
|
||||||
fgOptTerrasyncDir( const char *arg )
|
fgOptTerrasyncDir( const char *arg )
|
||||||
{
|
{
|
||||||
SGPath p = SGPath::fromLocal8Bit(arg);
|
SGPath p = SGPath::fromLocal8Bit(arg);
|
||||||
globals->append_fg_scenery(p, true);
|
globals->set_terrasync_dir(p);
|
||||||
fgSetString("/sim/terrasync/scenery-dir", p.utf8Str());
|
|
||||||
return FG_OPTIONS_OK;
|
return FG_OPTIONS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2377,7 +2376,7 @@ OptionResult Options::processOptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
// download dir fix-up
|
// download dir fix-up
|
||||||
SGPath downloadDir = SGPath::fromUtf8(fgGetString("/sim/paths/download-dir"));
|
SGPath downloadDir = SGPath::fromUtf8(valueForOption("download-dir"));
|
||||||
if (downloadDir.isNull()) {
|
if (downloadDir.isNull()) {
|
||||||
downloadDir = defaultDownloadDir();
|
downloadDir = defaultDownloadDir();
|
||||||
SG_LOG(SG_GENERAL, SG_INFO, "Using default download dir: " << downloadDir);
|
SG_LOG(SG_GENERAL, SG_INFO, "Using default download dir: " << downloadDir);
|
||||||
|
@ -2390,7 +2389,7 @@ OptionResult Options::processOptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
// terrasync directory fixup
|
// terrasync directory fixup
|
||||||
SGPath terrasyncDir = SGPath::fromUtf8(fgGetString("/sim/terrasync/scenery-dir"));
|
SGPath terrasyncDir = globals->get_terrasync_dir();
|
||||||
if (terrasyncDir.isNull()) {
|
if (terrasyncDir.isNull()) {
|
||||||
SGPath p(downloadDir);
|
SGPath p(downloadDir);
|
||||||
p.append("TerraSync");
|
p.append("TerraSync");
|
||||||
|
@ -2402,7 +2401,7 @@ OptionResult Options::processOptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
SG_LOG(SG_GENERAL, SG_INFO, "Using default TerraSync: " << terrasyncDir);
|
SG_LOG(SG_GENERAL, SG_INFO, "Using default TerraSync: " << terrasyncDir);
|
||||||
fgSetString("/sim/terrasync/scenery-dir", p.utf8Str());
|
globals->set_terrasync_dir(p);
|
||||||
} else {
|
} else {
|
||||||
SG_LOG(SG_GENERAL, SG_INFO, "Using explicit TerraSync dir: " << terrasyncDir);
|
SG_LOG(SG_GENERAL, SG_INFO, "Using explicit TerraSync dir: " << terrasyncDir);
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ void FGTileMgr::reinit()
|
||||||
_options->setPluginStringData("SimGear::FG_ROOT", globals->get_fg_root().local8BitStr());
|
_options->setPluginStringData("SimGear::FG_ROOT", globals->get_fg_root().local8BitStr());
|
||||||
|
|
||||||
if (_terra_sync) {
|
if (_terra_sync) {
|
||||||
_options->setPluginStringData("SimGear::TERRASYNC_ROOT", fgGetString("/sim/terrasync/scenery-dir"));
|
_options->setPluginStringData("SimGear::TERRASYNC_ROOT", globals->get_terrasync_dir().local8BitStr());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_disableNasalHooks->getBoolValue())
|
if (!_disableNasalHooks->getBoolValue())
|
||||||
|
|
Loading…
Add table
Reference in a new issue