# HG changeset patch # User Michael Pavone # Date 1546572641 28800 # Node ID ab3b465c052ca0598a10be08a4c8573756e7387a # Parent 12d0c7c4ad803498e42e48ba6b4e598df829ae7c Fix Windows implentation of get_config_dir() so config file gets saved to the right place. Fix location for sticky_path file on all platforms diff -r 12d0c7c4ad80 -r ab3b465c052c paths.c --- a/paths.c Thu Jan 03 09:14:49 2019 -0800 +++ b/paths.c Thu Jan 03 19:30:41 2019 -0800 @@ -7,8 +7,7 @@ static void persist_path(void) { - char const *parts[] = {get_userdata_dir(), PATH_SEP, "sticky_path"}; - char *pathfname = alloc_concat_m(3, parts); + char *pathfname = alloc_concat(get_userdata_dir(), PATH_SEP "blastem" PATH_SEP "sticky_path"); FILE *f = fopen(pathfname, "wb"); if (f) { if (fwrite(*current_path, 1, strlen(*current_path), f) != strlen(*current_path)) { @@ -63,8 +62,7 @@ *dst = NULL; char *remember_path = tern_find_path(config, "ui\0remember_path\0", TVAL_PTR).ptrval; if (!remember_path || !strcmp("on", remember_path)) { - char const *parts[] = {get_userdata_dir(), PATH_SEP, "sticky_path"}; - char *pathfname = alloc_concat_m(3, parts); + char *pathfname = alloc_concat(get_userdata_dir(), PATH_SEP "blastem" PATH_SEP "sticky_path"); FILE *f = fopen(pathfname, "rb"); if (f) { long pathsize = file_size(f); diff -r 12d0c7c4ad80 -r ab3b465c052c util.c --- a/util.c Thu Jan 03 09:14:49 2019 -0800 +++ b/util.c Thu Jan 03 19:30:41 2019 -0800 @@ -891,7 +891,14 @@ char const *get_config_dir() { - return get_userdata_dir(); + static char* confdir; + if (!confdir) { + char const *base = get_userdata_dir(); + if (base) { + confdir = alloc_concat(base, PATH_SEP "blastem"); + } + } + return confdir; } #define CONFIG_PREFIX "" #define SAVE_PREFIX ""