TerraSync: fix dir creation.
Separate the default path logic, from the 'create if not found' logic.
This commit is contained in:
parent
2dee846930
commit
931f4266fb
1 changed files with 6 additions and 5 deletions
|
@ -2041,17 +2041,18 @@ void Options::processOptions()
|
||||||
if (terrasyncDir.empty()) {
|
if (terrasyncDir.empty()) {
|
||||||
SGPath p(globals->get_fg_home());
|
SGPath p(globals->get_fg_home());
|
||||||
p.append("TerraSync");
|
p.append("TerraSync");
|
||||||
if (!p.exists()) {
|
|
||||||
simgear::Dir dd(p);
|
|
||||||
dd.create(0700);
|
|
||||||
}
|
|
||||||
|
|
||||||
terrasyncDir = p.str();
|
terrasyncDir = p.str();
|
||||||
SG_LOG(SG_GENERAL, SG_INFO,
|
SG_LOG(SG_GENERAL, SG_INFO,
|
||||||
"Using default TerraSync dir: " << terrasyncDir);
|
"Using default TerraSync dir: " << terrasyncDir);
|
||||||
fgSetString("/sim/terrasync/scenery-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());
|
const string_list& scenery_paths(globals->get_fg_scenery());
|
||||||
if (std::find(scenery_paths.begin(), scenery_paths.end(), terrasyncDir) == scenery_paths.end()) {
|
if (std::find(scenery_paths.begin(), scenery_paths.end(), terrasyncDir) == scenery_paths.end()) {
|
||||||
// terrasync dir is not in the scenery paths, add it
|
// terrasync dir is not in the scenery paths, add it
|
||||||
|
|
Loading…
Add table
Reference in a new issue