From 1b015de15661b6813a945c91b38dd87c481c0752 Mon Sep 17 00:00:00 2001 From: DRAGONTOS Date: Tue, 22 Oct 2024 03:48:13 +0200 Subject: [PATCH] bugfix: it now downloads the entire collection --- line-count | 6 +++--- src/Regex.cpp | 5 ----- src/includes/Regex.hpp | 1 - src/main.cpp | 1 - src/maincommand.cpp | 27 ++++++++++++++++----------- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/line-count b/line-count index 2f564cd..c0b1635 100644 --- a/line-count +++ b/line-count @@ -1,8 +1,8 @@ =============================================================================== Language Files Lines Code Comments Blanks =============================================================================== - C++ 4 320 253 20 47 - C++ Header 4 67 54 5 8 + C++ 4 319 251 21 47 + C++ Header 4 66 53 5 8 =============================================================================== - Total 8 387 307 25 55 + Total 8 385 304 26 55 =============================================================================== diff --git a/src/Regex.cpp b/src/Regex.cpp index 9f632fd..d7427c4 100644 --- a/src/Regex.cpp +++ b/src/Regex.cpp @@ -1,5 +1,3 @@ -#include -#include #include #include #include "regex" @@ -41,9 +39,7 @@ void Regex(cmd *inputCmd) { // Step 6: Write "+quit" at the end of the output buffer inputCmd->ids += "+quit\n"; } -} -void slashing(cmd *inputCmd) { std::istringstream inputStream(inputCmd->ids); std::string line; @@ -51,5 +47,4 @@ void slashing(cmd *inputCmd) { while (std::getline(inputStream, line)) { inputCmd->slashtp++; } - inputCmd->slash = (inputCmd->slashtp == 2) ? R"( )": R"( \ )"; } diff --git a/src/includes/Regex.hpp b/src/includes/Regex.hpp index ed2fc45..291ce57 100644 --- a/src/includes/Regex.hpp +++ b/src/includes/Regex.hpp @@ -30,5 +30,4 @@ int totalmeow = 0; }; void Regex(cmd *inputCmd); -void slashing(cmd *inputCmd); #endif diff --git a/src/main.cpp b/src/main.cpp index 9da28cd..72f2a6d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -142,7 +142,6 @@ int main(int argc, char **argv, char **envp) { // main functions Regex(&inputCmd); - slashing(&inputCmd); maincommand(&inputCmd); return 1; diff --git a/src/maincommand.cpp b/src/maincommand.cpp index 0bbab25..8d29121 100644 --- a/src/maincommand.cpp +++ b/src/maincommand.cpp @@ -1,5 +1,7 @@ +#include #include #include +#include #include #include #include @@ -30,6 +32,9 @@ void execAndDisplay(cmd *inputCmd, const std::string& cmd, std::atomic& ru // checks for errors. if (line.find("ERROR!") != std::string::npos) { inputCmd->errors++; + // tmp fix for errors. + std::ofstream meow{"/home/rander/.cache/errors.txt"}; + meow << "start:\n" + line; } inputCmd->totalmeow++; @@ -54,13 +59,12 @@ void maincommand(cmd *inputCmd) { std::string idsm = (inputCmd->ab == 1) ? R"( +workshop_download_item )" + inputCmd->gameid + " " + inputCmd->modid + " +quit": R"()"; std::string maincommand2 = std::string{"sh ~/Steam/steamcmd.sh +force_install_dir " - + inputCmd->dir - + " +login " - + inputCmd->user - + inputCmd->pass - + inputCmd->slash - + idsm - + inputCmd->ids}.c_str(); + + inputCmd->dir + + " +login " + + inputCmd->user + + ((inputCmd->pass.empty()) ? "" : inputCmd->pass) + + " " + + ((inputCmd->ab == 1) ? idsm: inputCmd->ids)}.c_str(); try { std::atomic running(true); @@ -78,10 +82,11 @@ void maincommand(cmd *inputCmd) { std::string colm = (inputCmd->ab == 1) ? R"(Mod)": R"(Collection)"; // shows how much and what has downloaded - std::string mods = total + "\n" - + "Finished: " + std::to_string(inputCmd->successes +1) + "\n" - + "Timed out: " + std::to_string(inputCmd->timedout) + "\n" - + "Errored: " + std::to_string(inputCmd->errors) + "\n" + "\n"; + std::string mods = total + + "\n" + + "Finished: " + std::to_string(inputCmd->successes) + "\n" + + "Timed out: " + std::to_string(inputCmd->timedout) + "\n" + + "Errored: " + std::to_string(inputCmd->errors) + "\n" + "\n"; std::cout << "\n\n" + mods + colm + " has been downloaded too: " + inputCmd->dir + "\n"; }