GBA Config: Functions for loading and saving configs from a path

This commit is contained in:
Jeffrey Pfau 2015-07-21 19:22:02 -07:00
parent 037e518f5c
commit 0ecdc1ac44
2 changed files with 11 additions and 1 deletions

View File

@ -116,13 +116,21 @@ bool GBAConfigLoad(struct GBAConfig* config) {
char path[PATH_MAX];
GBAConfigDirectory(path, PATH_MAX);
strncat(path, PATH_SEP "config.ini", PATH_MAX - strlen(path));
return ConfigurationRead(&config->configTable, path);
return GBAConfigLoadPath(config, path);
}
bool GBAConfigSave(const struct GBAConfig* config) {
char path[PATH_MAX];
GBAConfigDirectory(path, PATH_MAX);
strncat(path, PATH_SEP "config.ini", PATH_MAX - strlen(path));
return GBAConfigSavePath(config, path);
}
bool GBAConfigLoadPath(struct GBAConfig* config, const char* path) {
return ConfigurationRead(&config->configTable, path);
}
bool GBAConfigSavePath(const struct GBAConfig* config, const char* path) {
return ConfigurationWrite(&config->configTable, path);
}

View File

@ -51,6 +51,8 @@ void GBAConfigDeinit(struct GBAConfig*);
bool GBAConfigLoad(struct GBAConfig*);
bool GBAConfigSave(const struct GBAConfig*);
bool GBAConfigLoadPath(struct GBAConfig*, const char* path);
bool GBAConfigSavePath(const struct GBAConfig*, const char* path);
void GBAConfigMakePortable(const struct GBAConfig*);
void GBAConfigDirectory(char* out, size_t outLength);