- Added checks to ensure that a shadow.file value doesn't collide with either the pending.data or completed.data files.

This commit is contained in:
Paul Beckingham 2008-10-09 21:24:12 -04:00
parent 62115ea988
commit b4b389c27e

View file

@ -301,14 +301,27 @@ int main (int argc, char** argv)
TDB tdb;
gTdb = &tdb;
tdb.dataDirectory (expandPath (conf.get ("data.location")));
std::string dataLocation = expandPath (conf.get ("data.location"));
tdb.dataDirectory (dataLocation);
// Log commands, if desired.
if (conf.get ("command.logging") == "on")
tdb.logCommand (argc, argv);
// Set up TDB callback.
tdb.onChange (&onChangeCallback);
std::string shadowFile = expandPath (conf.get ("shadow.file"));
if (shadowFile != "")
{
if (shadowFile == dataLocation + "/pending.data")
throw std::string ("Configuration variable 'shadow.file' is set to "
"overwrite your pending tasks. Please change it.");
if (shadowFile == dataLocation + "/completed.data")
throw std::string ("Configuration variable 'shadow.file' is set to "
"overwrite your completed tasks. Please change it.");
tdb.onChange (&onChangeCallback);
}
runTaskCommand (argc, argv, tdb, conf);
}