Mercurial > repos > blastem
comparison config.c @ 2477:2972a8e16ed2
Make sticky_path respect save config with EXE option
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 05 Mar 2024 23:23:06 -0800 |
parents | 64cf80e683aa |
children | 8cf7cadc17ee |
comparison
equal
deleted
inserted
replaced
2476:aaf7bb58ffca | 2477:2972a8e16ed2 |
---|---|
503 migrate_config(ret, config_version); | 503 migrate_config(ret, config_version); |
504 } | 504 } |
505 return ret; | 505 return ret; |
506 } | 506 } |
507 | 507 |
508 uint8_t is_config_in_exe_dir(tern_node *app_config) | |
509 { | |
510 char*use_exe_dir = tern_find_path_default(app_config, "ui\0config_in_exe_dir\0", (tern_val){.ptrval = "off"}, TVAL_PTR).ptrval; | |
511 return !strcmp(use_exe_dir, "on"); | |
512 } | |
513 | |
508 void persist_config_at(tern_node *app_config, tern_node *to_save, char *fname) | 514 void persist_config_at(tern_node *app_config, tern_node *to_save, char *fname) |
509 { | 515 { |
510 char*use_exe_dir = tern_find_path_default(app_config, "ui\0config_in_exe_dir\0", (tern_val){.ptrval = "off"}, TVAL_PTR).ptrval; | |
511 char *confpath; | 516 char *confpath; |
512 if (!strcmp(use_exe_dir, "on")) { | 517 if (is_config_in_exe_dir(app_config)) { |
513 confpath = path_append(get_exe_dir(), fname); | 518 confpath = path_append(get_exe_dir(), fname); |
514 if (app_config == to_save && app_config_in_config_dir) { | 519 if (app_config == to_save && app_config_in_config_dir) { |
515 //user switched to "portable" configs this session and there is an | 520 //user switched to "portable" configs this session and there is an |
516 //existing config file in the user-specific config directory | 521 //existing config file in the user-specific config directory |
517 //delete it so we don't end up loading it next time | 522 //delete it so we don't end up loading it next time |