TerraSync: add a warning file to the root dir.

Try to discourage users from adding custom content underneath the
Terrasync dir, since it can be over-written.
This commit is contained in:
James Turner
2021-04-02 16:45:50 +01:00
parent 0343ef7246
commit ae920c6ebd
2 changed files with 23 additions and 0 deletions

View File

@@ -1181,6 +1181,9 @@ void SGTerraSync::reinit()
SGPath sceneryRoot{_terraRoot->getStringValue("scenery-dir", "")};
_workerThread->setLocalDir(sceneryRoot.utf8Str());
if (sceneryRoot.exists()) {
writeWarningFile(sceneryRoot);
}
SGPath installPath(_terraRoot->getStringValue("installation-dir"));
_workerThread->setInstalledDir(installPath);
@@ -1419,6 +1422,23 @@ void SGTerraSync::reposition()
// stub, remove
}
void SGTerraSync::writeWarningFile(const SGPath& sceneryDir)
{
SGPath p = sceneryDir / "TerraSync-WARNING.txt";
if (p.exists())
return;
sg_ofstream os(p, std::ios::out | std::ios::trunc);
os << "This folder is managed by FlightGear's download system.\n";
os << "Any changes you make here or in sub-folders will be overwritten when TerraSync\n";
os << "downloads updates.\n";
os << "\n";
os << "To use custom scenery or data with FlightGear, put it in a differnet location\n";
os << "on your computer, then add the location using either the launcher 'Add-ons' page, or by\n";
os << "passing '--fg-scenery=<location>' on the command line.";
os << endl;
}
// Register the subsystem.
SGSubsystemMgr::Registrant<SGTerraSync> registrantSGTerraSync(

View File

@@ -90,6 +90,9 @@ protected:
class WorkerThread;
private:
void writeWarningFile(const SGPath& sceneryDir);
private:
WorkerThread* _workerThread;
SGPropertyNode_ptr _terraRoot;