From b639a2d79a056afd106fb898873d5021f27bff8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana=20G=C3=B3mez?= Date: Wed, 14 May 2025 12:51:56 +0200 Subject: [PATCH] Fix folder param in b_manage --- Makefile | 4 +++- src/commands/b_manage.cpp | 3 +++ src/manage/ManageScreen.cpp | 10 +++++----- src/manage/ManageScreen.h | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 1b810c9..fa659c8 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,9 @@ install: ## Copy binary files to bin folder @echo "*******************************************" @for item in $(app_targets); do \ echo ">>> Copying $$item" ; \ - cp $(f_release)/src/$$item $(dest) ; \ + cp $(f_release)/src/$$item $(dest) || { \ + echo "*** Error copying $$item" ; \ + } ; \ done dependency: ## Create a dependency graph diagram of the project (build/dependency.png) diff --git a/src/commands/b_manage.cpp b/src/commands/b_manage.cpp index 66a2ea6..1d88ca2 100644 --- a/src/commands/b_manage.cpp +++ b/src/commands/b_manage.cpp @@ -119,6 +119,9 @@ int main(int argc, char** argv) manageArguments(program, argc, argv); std::string model = program.get("model"); std::string path = program.get("folder"); + if (path.back() != '/') { + path += '/'; + } std::string score = program.get("score"); std::string platform = program.get("platform"); bool complete = program.get("complete"); diff --git a/src/manage/ManageScreen.cpp b/src/manage/ManageScreen.cpp index f4b11d1..d9f65fc 100644 --- a/src/manage/ManageScreen.cpp +++ b/src/manage/ManageScreen.cpp @@ -18,8 +18,8 @@ namespace platform { const std::string STATUS_OK = "Ok."; const std::string STATUS_COLOR = Colors::GREEN(); - ManageScreen::ManageScreen(const std::string path, int rows, int cols, const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial, bool compare) : - rows{ rows }, cols{ cols }, complete{ complete }, partial{ partial }, compare{ compare }, didExcel(false), results(ResultsManager(path, model, score, platform, complete, partial)) + ManageScreen::ManageScreen(const std::string path_, int rows, int cols, const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial, bool compare) : + path{ path_ }, rows{ rows }, cols{ cols }, complete{ complete }, partial{ partial }, compare{ compare }, didExcel(false), results(ResultsManager(path_, model, score, platform, complete, partial)) { results.load(); openExcel = false; @@ -329,11 +329,11 @@ namespace platform { return; } // Remove the old result file - std::string oldFile = Paths::results() + results.at(index).getFilename(); + std::string oldFile = path + results.at(index).getFilename(); std::filesystem::remove(oldFile); // Actually change the model results.at(index).setModel(newModel); - results.at(index).save(); + results.at(index).save(path); int newModelSize = static_cast(newModel.size()); if (newModelSize > maxModel) { maxModel = newModelSize; @@ -583,7 +583,7 @@ namespace platform { getline(std::cin, newTitle); if (!newTitle.empty()) { results.at(index).setTitle(newTitle); - results.at(index).save(); + results.at(index).save(path); list("Title changed to " + newTitle, Colors::GREEN()); break; } diff --git a/src/manage/ManageScreen.h b/src/manage/ManageScreen.h index 7aab91d..46a02c4 100644 --- a/src/manage/ManageScreen.h +++ b/src/manage/ManageScreen.h @@ -59,7 +59,7 @@ namespace platform { std::vector paginator; ResultsManager results; lxw_workbook* workbook; - std::string excelFileName; + std::string path, excelFileName; }; } #endif \ No newline at end of file