diff options
author | Michael Pavone <pavone@retrodev.com> | 2017-03-21 00:40:25 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2017-03-21 00:40:25 -0700 |
commit | f8d991fc1b1ab7ae0c3d8a0307b8b2419d152278 (patch) | |
tree | 6e096f49fe0a837e98c21550ab03d4e59fbb4e75 /menu.c | |
parent | 7555497336ede90b9560d66684001c81902b01e1 (diff) |
Allow initial_path to contain variable references which allows the default value to be actually specified in the default config file
Diffstat (limited to 'menu.c')
-rw-r--r-- | menu.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -167,15 +167,16 @@ void * menu_write_w(uint32_t address, void * context, uint16_t value) if (!menu) { gen->extra = menu = calloc(1, sizeof(menu_context)); menu->curpath = tern_find_path(config, "ui\0initial_path\0").ptrval; - if (menu->curpath) { - menu->curpath = strdup(menu->curpath); - } else { + if (!menu->curpath){ #ifdef __ANDROID__ - menu->curpath = strdup(get_external_storage_path()); + menu->curpath = get_external_storage_path(); #else - menu->curpath = strdup(get_home_dir()); + menu->curpath = "$HOME"; #endif } + tern_node *vars = tern_insert_ptr(NULL, "HOME", get_home_dir()); + vars = tern_insert_ptr(vars, "EXEDIR", get_exe_dir()); + menu->curpath = replace_vars(menu->curpath, vars, 1); } if (menu->state) { uint32_t dst = menu->latch << 16 | value; |