Updated the config.cpp
This commit is contained in:
parent
04904c04bc
commit
98a9b068a4
@ -2,8 +2,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#define CONFIG_FILE "config.json"
|
|
||||||
|
|
||||||
bool config::is_valid_config(const json& config) {
|
bool config::is_valid_config(const json& config) {
|
||||||
|
|
||||||
if (!config.contains("token")) {
|
if (!config.contains("token")) {
|
||||||
@ -14,12 +12,12 @@ bool config::is_valid_config(const json& config) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
json config::read_config() {
|
json config::read_config(const std::string& path) {
|
||||||
json config;
|
json config;
|
||||||
std::ifstream config_file(CONFIG_FILE);
|
std::ifstream config_file(path);
|
||||||
|
|
||||||
if (!config_file.is_open()) {
|
if (!config_file.is_open()) {
|
||||||
std::cout << "Failed to open config file. Please create a " << CONFIG_FILE << " file in the same directory as the executable." << std::endl;
|
std::cout << "Failed to open config file. Please create a " << path << " file in the same directory as the executable." << std::endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user