From f2d9c61878e829ea50d8775544018586844d6033 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 1 Mar 2016 20:13:25 -0500 Subject: [PATCH] Database: Added ::initialize --- src/Database.cpp | 18 ++++++++++++++++++ src/Database.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/src/Database.cpp b/src/Database.cpp index ae0b555d..9669928f 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -26,7 +26,25 @@ #include #include +#include #include +#include // TODO Remove + +//////////////////////////////////////////////////////////////////////////////// +void Database::initialize (const std::string& location) +{ + _location = location; + + Directory d (_location); + for (const auto& file : d.list ()) + { + if (1 /* looks like one of our data files */) + { + _data_files.push_back (file); + std::cout << "# data file " << file << "\n"; + } + } +} //////////////////////////////////////////////////////////////////////////////// std::string Database::dump () const diff --git a/src/Database.h b/src/Database.h index 97974bb9..073142e1 100644 --- a/src/Database.h +++ b/src/Database.h @@ -34,9 +34,11 @@ class Database { public: Database () = default; + void initialize (const std::string&); std::string dump () const; private: + std::string _location {"~/.timewarrior"}; std::vector _data_files {}; };