mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
Abort initialization if user does not confirm creation of new database
Fixes #489 Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
8ba588dc24
commit
7c316b2ae1
3 changed files with 13 additions and 5 deletions
1
AUTHORS
1
AUTHORS
|
@ -98,3 +98,4 @@ Thanks to the following, who submitted detailed bug reports and excellent sugges
|
|||
sclee15
|
||||
varac
|
||||
xerus2000
|
||||
Rafael Oliveira
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
- #489 First execution creates database regardless of confirmation response
|
||||
(thanks to Rafael Oliveira)
|
||||
- #403 Remove incorrect output stating that an empty interval was recorded
|
||||
(thanks to xeruf)
|
||||
- #408 Update documentation of hint `:all`
|
||||
|
|
15
src/init.cpp
15
src/init.cpp
|
@ -169,12 +169,17 @@ void initializeDataJournalAndRules (
|
|||
// If dbLocation does not exist, ask whether it should be created.
|
||||
bool shinyNewDatabase = false;
|
||||
|
||||
if (! dbLocation.exists () &&
|
||||
(cli.getHint ("yes", false) ||
|
||||
confirm ("Create new database in " + dbLocation._data + "?")))
|
||||
if (! dbLocation.exists ())
|
||||
{
|
||||
dbLocation.create (0700);
|
||||
shinyNewDatabase = true;
|
||||
if ((cli.getHint ("yes", false) || confirm ("Create new database in " + dbLocation._data + "?")))
|
||||
{
|
||||
dbLocation.create (0700);
|
||||
shinyNewDatabase = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::string("Initial setup aborted by user");
|
||||
}
|
||||
}
|
||||
|
||||
// Create extensions subdirectory if necessary.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue