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
15
src/task.cpp
15
src/task.cpp
|
@ -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.
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue