Mercurial > repos > blastem
diff config.c @ 866:69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 06 Nov 2015 12:19:39 -0800 |
parents | 46bb673eed4e |
children | 54ffba3768d6 |
line wrap: on
line diff
--- a/config.c Fri Nov 06 11:44:51 2015 -0800 +++ b/config.c Fri Nov 06 12:19:39 2015 -0800 @@ -43,7 +43,7 @@ config_data = started ? NULL : *state; while ((curline = strtok_r(config_data, "\n", state))) { - + config_data = NULL; curline = strip_ws(curline); int len = strlen(curline); @@ -61,7 +61,7 @@ } fatal_error("unexpected } on line %d\n", *line); } - + char * end = curline + len - 1; if (*end == '{') { *end = 0; @@ -128,7 +128,7 @@ if (!config_size) { goto config_empty; } - + char * config_data = malloc(config_size+1); if (SDL_RWread(rw, config_data, 1, config_size) != config_size) { goto config_read_fail; @@ -152,12 +152,12 @@ if (ret) { return ret; } - + ret = parse_config_file_assets("default.cfg"); if (ret) { return ret; } - + fatal_error("Failed to find a config file in internal storage or in the blastem APK\n"); //this will never get reached, but the compiler doesn't know that. Let's make it happy return NULL; @@ -169,25 +169,26 @@ { char * exe_dir; char * home = get_home_dir(); - if (home) { + tern_node *ret; + if (home) { char * path = alloc_concat(home, "/.config/blastem/blastem.cfg"); - tern_node * ret = parse_config_file(path); - free(path); - if (ret) { - return ret; - } - } - - exe_dir = get_exe_dir(); - if (exe_dir) { - path = alloc_concat(exe_dir, "/default.cfg"); ret = parse_config_file(path); free(path); if (ret) { return ret; } } - + + exe_dir = get_exe_dir(); + if (exe_dir) { + char *path = alloc_concat(exe_dir, "/default.cfg"); + ret = parse_config_file(path); + free(path); + if (ret) { + return ret; + } + } + fatal_error("Failed to find a config file in ~/.config/blastem/blastem.cfg or in the blastem executable directory\n"); //this will never get reached, but the compiler doesn't know that. Let's make it happy return NULL;