|
|
|
@ -3,8 +3,8 @@ |
|
|
|
|
#include "days/days.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> getInput(int day, std::string key, bool useTestInput) { |
|
|
|
|
std::vector<std::string> result; |
|
|
|
|
Input getInput(int day, std::string key, bool useTestInput) { |
|
|
|
|
Input input; |
|
|
|
|
|
|
|
|
|
char dayStrPadded[3]; |
|
|
|
|
sprintf(dayStrPadded, "%02u", day); |
|
|
|
@ -13,7 +13,7 @@ std::vector<std::string> getInput(int day, std::string key, bool useTestInput) { |
|
|
|
|
|
|
|
|
|
if (!std::filesystem::exists({localFilePath})) { |
|
|
|
|
if (key.empty()) |
|
|
|
|
return result; |
|
|
|
|
return input; |
|
|
|
|
std::string dayStr = std::to_string(day); |
|
|
|
|
std::string url = "https://adventofcode.com/2021/day/" + dayStr + "/input"; |
|
|
|
|
std::cout << "Input does not exist. Fetching from " + url << std::endl; |
|
|
|
@ -26,11 +26,11 @@ std::vector<std::string> getInput(int day, std::string key, bool useTestInput) { |
|
|
|
|
|
|
|
|
|
std::string line; |
|
|
|
|
while (std::getline(file, line)) |
|
|
|
|
result.push_back(line); |
|
|
|
|
input.push_back(line); |
|
|
|
|
|
|
|
|
|
file.close(); |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
return input; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::string getSessionKey() { |
|
|
|
|