Fix mod storage again

This commit is contained in:
MysterD 2023-11-26 14:15:44 -08:00
parent 0204b2673d
commit e0e4541db6
1 changed files with 10 additions and 2 deletions

View File

@ -116,12 +116,20 @@ bool mod_storage_save(const char *key, const char *value) {
} }
} }
char lowerKey[MAX_KEY_VALUE_LENGTH];
snprintf(lowerKey, MAX_KEY_VALUE_LENGTH, "%s", key);
for (int i = 0; i < MAX_KEY_VALUE_LENGTH; i++) {
if (lowerKey[i] == '\0') { break; }
lowerKey[i] = tolower(lowerKey[i]);
}
ConfigRemoveKey(cfg, "storage", lowerKey);
ConfigRemoveKey(cfg, "storage", key); ConfigRemoveKey(cfg, "storage", key);
ConfigAddString(cfg, "storage", key, value); ConfigAddString(cfg, "storage", key, value);
ConfigPrint(cfg, file);
ConfigFree(cfg);
fclose(file); fclose(file);
ConfigPrintToFile(cfg, filename);
ConfigFree(cfg);
free(filename); free(filename);
return true; return true;