1
0
Fork 0

TerraSync: fix dir creation.

Separate the default path logic, from the 'create if
not found' logic.
This commit is contained in:
James Turner 2013-06-09 19:11:41 +01:00
parent 2dee846930
commit 931f4266fb

View file

@ -2041,17 +2041,18 @@ void Options::processOptions()
if (terrasyncDir.empty()) {
SGPath p(globals->get_fg_home());
p.append("TerraSync");
if (!p.exists()) {
simgear::Dir dd(p);
dd.create(0700);
}
terrasyncDir = p.str();
SG_LOG(SG_GENERAL, SG_INFO,
"Using default TerraSync dir: " << terrasyncDir);
fgSetString("/sim/terrasync/scenery-dir", terrasyncDir);
}
SGPath p(terrasyncDir);
if (!p.exists()) {
simgear::Dir dd(p);
dd.create(0700);
}
const string_list& scenery_paths(globals->get_fg_scenery());
if (std::find(scenery_paths.begin(), scenery_paths.end(), terrasyncDir) == scenery_paths.end()) {
// terrasync dir is not in the scenery paths, add it