diff --git a/include/consts.hpp b/include/consts.hpp index fc66c35..5d3dd20 100644 --- a/include/consts.hpp +++ b/include/consts.hpp @@ -3,4 +3,6 @@ // Setting both values to 0 does not compile logging constexpr unsigned max_log_size = 100; constexpr unsigned pre_log_size = 10; -constexpr unsigned max_name_size = 50; \ No newline at end of file +constexpr unsigned max_name_size = 50; +constexpr const char *users_location = "../users.json"; +constexpr const char *config_location = "../config.json"; \ No newline at end of file diff --git a/main.cpp b/main.cpp index d8f7283..4babcca 100644 --- a/main.cpp +++ b/main.cpp @@ -73,7 +73,7 @@ int main(int argc, char **argv) [](const drogon::HttpRequestPtr &req, const drogon::HttpResponsePtr &resp) { resp->addHeader("Access-Control-Allow-Origin", "*"); }); - app().loadConfigFile("../config.json").registerController(API).setThreadNum(std::stoul(argv[3])).run(); + app().loadConfigFile(config_location).registerController(API).setThreadNum(std::stoul(argv[3])).run(); return 0; } diff --git a/src/bank.cpp b/src/bank.cpp index 195af3e..cf2cddc 100644 --- a/src/bank.cpp +++ b/src/bank.cpp @@ -238,7 +238,7 @@ void Bank::Save() } else { - std::ofstream user_save("../users.json"); + std::ofstream user_save(users_location); Json::StreamWriterBuilder builder; const std::unique_ptr writer(builder.newStreamWriter()); writer->write(temp, &user_save); @@ -252,7 +252,7 @@ void Bank::Load() Json::CharReaderBuilder builder; Json::Value temp; - std::ifstream user_save("../users.json"); + std::ifstream user_save(users_location); builder["collectComments"] = true; JSONCPP_STRING errs; if (!parseFromStream(builder, user_save, &temp, &errs))