mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-07 21:56:44 +01:00
config: fix config file handling when custom file interface is in effect
This commit is contained in:
parent
67056f0f55
commit
7ab739db54
1 changed files with 6 additions and 0 deletions
|
@ -22,6 +22,8 @@
|
|||
#include "config.h"
|
||||
|
||||
SYMBOL_EXPORT void InitConfig(struct Game *game) {
|
||||
const ALLEGRO_FILE_INTERFACE *interface = al_get_new_file_interface();
|
||||
al_set_standard_file_interface();
|
||||
ALLEGRO_PATH *path = al_get_standard_path(ALLEGRO_USER_SETTINGS_PATH);
|
||||
ALLEGRO_PATH *data = al_create_path("SuperDerpy.ini");
|
||||
al_join_paths(path, data);
|
||||
|
@ -29,6 +31,7 @@ SYMBOL_EXPORT void InitConfig(struct Game *game) {
|
|||
if (!game->_priv.config) game->_priv.config=al_create_config();
|
||||
al_destroy_path(path);
|
||||
al_destroy_path(data);
|
||||
al_set_new_file_interface(interface);
|
||||
}
|
||||
|
||||
SYMBOL_EXPORT void SetConfigOption(struct Game *game, char* section, char* name, char* value) {
|
||||
|
@ -45,6 +48,8 @@ SYMBOL_EXPORT const char* GetConfigOptionDefault(struct Game *game, char* sectio
|
|||
}
|
||||
|
||||
SYMBOL_EXPORT void DeinitConfig(struct Game *game) {
|
||||
const ALLEGRO_FILE_INTERFACE *interface = al_get_new_file_interface();
|
||||
al_set_standard_file_interface();
|
||||
ALLEGRO_PATH *path = al_get_standard_path(ALLEGRO_USER_SETTINGS_PATH);
|
||||
ALLEGRO_PATH *data = al_create_path("SuperDerpy.ini");
|
||||
al_make_directory(al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP));
|
||||
|
@ -53,4 +58,5 @@ SYMBOL_EXPORT void DeinitConfig(struct Game *game) {
|
|||
al_destroy_path(path);
|
||||
al_destroy_path(data);
|
||||
al_destroy_config(game->_priv.config);
|
||||
al_set_new_file_interface(interface);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue