mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
- 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:
parent
62115ea988
commit
b4b389c27e
1 changed files with 15 additions and 2 deletions
17
src/task.cpp
17
src/task.cpp
|
@ -301,14 +301,27 @@ int main (int argc, char** argv)
|
||||||
|
|
||||||
TDB tdb;
|
TDB tdb;
|
||||||
gTdb = &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.
|
// Log commands, if desired.
|
||||||
if (conf.get ("command.logging") == "on")
|
if (conf.get ("command.logging") == "on")
|
||||||
tdb.logCommand (argc, argv);
|
tdb.logCommand (argc, argv);
|
||||||
|
|
||||||
// Set up TDB callback.
|
// 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);
|
runTaskCommand (argc, argv, tdb, conf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue