|
|
@ -4,12 +4,10 @@ |
|
|
|
config::config(const string _configFilePath, const vector<string> _necessary) { |
|
|
|
config::config(const string _configFilePath, const vector<string> _necessary) { |
|
|
|
necessary = _necessary; |
|
|
|
necessary = _necessary; |
|
|
|
if(!init(_configFilePath)) { |
|
|
|
if(!init(_configFilePath)) { |
|
|
|
cout << "ERROR init config file" << endl; |
|
|
|
throw "[ERROR] Init config file "; |
|
|
|
exit(1); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (!isHaveNecessary()) { |
|
|
|
if (!isHaveNecessary()) { |
|
|
|
cout << "ERROR Konfiguracijska datoteka nema sva nužna polja!" << endl; |
|
|
|
throw "[ERROR] Configuration file does not have all the required fields "; |
|
|
|
exit(2); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -23,7 +21,7 @@ bool config::init(const string _configFilePath) { |
|
|
|
ifstream configFile;
|
|
|
|
ifstream configFile;
|
|
|
|
configFile.open(_configFilePath, ios::in);
|
|
|
|
configFile.open(_configFilePath, ios::in);
|
|
|
|
if(!configFile) {
|
|
|
|
if(!configFile) {
|
|
|
|
printf ("[CRITICAL ERROR] Nema konfiguracijske datoteke!"); |
|
|
|
//printf ("[CRITICAL ERROR] Nema konfiguracijske datoteke!");
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|