mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
init: Added determination of database location
This commit is contained in:
parent
343426d70e
commit
be893f0551
1 changed files with 26 additions and 1 deletions
27
src/init.cpp
27
src/init.cpp
|
@ -53,7 +53,32 @@ bool lightweightVersionCheck (int argc, const char** argv)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void initializeData (Configuration& configuration, Database& database)
|
void initializeData (Configuration& configuration, Database& database)
|
||||||
{
|
{
|
||||||
// TODO Load configuration ~/.timewrc || $TIMEWRC.
|
// The $TIMEWARRIORDB environment variable overrides the default value of
|
||||||
|
// ~/.timewarrior‥
|
||||||
|
Directory dbLocation;
|
||||||
|
char* override = getenv ("TIMEWARRIORDB");
|
||||||
|
if (override)
|
||||||
|
{
|
||||||
|
std::cout << "# TIMEWARRIORDB " << override << "\n";
|
||||||
|
dbLocation = Directory (override);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dbLocation = Directory ("~/.timewarrior");
|
||||||
|
std::cout << "# Using default DB location " << dbLocation._data << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO If dbLocation does not exist, ask whether it should be created.
|
||||||
|
// TODO IF dbLocation exists, but is not readable/writable/executable, error.
|
||||||
|
|
||||||
|
// TODO Load the configuration data.
|
||||||
|
|
||||||
|
// This value is not written out to disk, as there would be no point. Having
|
||||||
|
// located the config file, the 'db' location is already known. This is just
|
||||||
|
// for subsequent internal use.
|
||||||
|
configuration.set ("db", dbLocation._data);
|
||||||
|
std::cout << "# rc.db=" << configuration.get ("db") << "\n";
|
||||||
|
|
||||||
// TODO Init database (no data read).
|
// TODO Init database (no data read).
|
||||||
|
|
||||||
std::cout << "# Configuration\n";
|
std::cout << "# Configuration\n";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue