This commit is contained in:
tildearrow 2023-04-04 15:40:01 -05:00
parent 3a84512486
commit 34a15adc7f

View file

@ -67,7 +67,8 @@ void DivConfig::parseLine(const char* line) {
String value=""; String value="";
bool keyOrValue=false; bool keyOrValue=false;
for (const char* i=line; *i; i++) { for (const char* i=line; *i; i++) {
if (*i=='\n') continue; if (*i=='\r') continue;
if (*i=='\n') break;
if (keyOrValue) { if (keyOrValue) {
value+=*i; value+=*i;
} else { } else {
@ -91,10 +92,10 @@ bool DivConfig::loadFromFile(const char* path, bool createOnFail) {
logD("config does not exist"); logD("config does not exist");
if (createOnFail) { if (createOnFail) {
logI("creating default config."); logI("creating default config.");
showWarning(fmt::sprintf("Creating default config: %s",strerror(errno)); reportError(fmt::sprintf("Creating default config: %s",strerror(errno));
return save(path); return save(path);
} else { } else {
showWarning(fmt::sprintf("COULD NOT LOAD CONFIG %s",strerror(errno)); reportError(fmt::sprintf("COULD NOT LOAD CONFIG %s",strerror(errno));
return false; return false;
} }
} }
@ -105,6 +106,7 @@ bool DivConfig::loadFromFile(const char* path, bool createOnFail) {
} }
parseLine(line); parseLine(line);
} }
logD("end of file (%s)",strerror(errno));
fclose(f); fclose(f);
return true; return true;
} }