From 5098dc0357dd37e8bcbafd1bdaeb51ecc49022c0 Mon Sep 17 00:00:00 2001 From: Patrick Lipka Date: Fri, 1 Apr 2022 14:58:07 +0200 Subject: [PATCH] Added month string to the tracking file data and leagcy mode for old files --- src/project.cpp | 17 ++++++++++++++++- src/project.h | 2 +- src/ui.cpp | 15 ++++++++++++--- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/project.cpp b/src/project.cpp index f6f2281..25545ad 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -94,6 +94,9 @@ void ProjectList::save(std::string file_name){ if (!of){ std::cout << "Could not open file " << file_name << " for writing!" << std::endl; } + size_t month_len = month.length(); + of.write((char*) &month_len, sizeof(size_t)); + of.write((char*) month.c_str(), month_len); of.write((char*) &num_projects, sizeof(int)); of.write((char*) &active_project_id, sizeof(int)); for (int i=0; i 0){ std::cout << "Report for " << user_name << ", month: " << date_str << std::endl << std::endl; for (int i=0; imonth; std::string command = "mkdir -p "+tracking_dir; system (command.c_str()); proj_list->save(file_name);