From 3ae4d2878ce97846313f954401b2848f3687cb64 Mon Sep 17 00:00:00 2001 From: Karl Kleinpaste Date: Sun, 18 Aug 2024 08:30:43 -0400 Subject: [PATCH] #1171 on 2nd thought, for windows, also get rid of dot; use g_rename; dont neglect to free old name. --- src/main/settings.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/settings.c b/src/main/settings.c index 8d0283b88..d2e93f61b 100644 --- a/src/main/settings.c +++ b/src/main/settings.c @@ -56,12 +56,8 @@ /****************************************************************************** * defines */ -#ifndef WIN32 #define XI_DIR "xiphos" /* modern choice, within ~/.config */ #define OLD_XI_DIR ".xiphos" /* for compatibility movement */ -#else -#define XI_DIR ".xiphos" /* kept the same for Windows users */ -#endif /****************************************************************************** * globals @@ -116,26 +112,30 @@ int settings_init(int argc, char **argv, int new_configs, /* set gSwordDir to $home + .xiphos */ settings.gSwordDir = - g_build_filename(settings.homedir, ".config", XI_DIR, NULL); - + g_build_filename(settings.homedir, #ifndef WIN32 + ".config", +#endif + XI_DIR, NULL); + /* --------------------------------------------------------------- */ - /* for Linux, convert from old presence in ~, move into ~/.config. */ + /* convert old presence in ~, move into ~/.config (linux), no dot. */ old_gSwordDir = g_build_filename(settings.homedir, OLD_XI_DIR, NULL); if ((g_access(old_gSwordDir, F_OK) == 0) && (g_access(settings.gSwordDir, F_OK) != 0)) { /* ~/.xiphos exists, but not ~/.config/xiphos: move. */ - if (rename(old_gSwordDir, settings.gSwordDir) == 0) { + if (g_rename(old_gSwordDir, settings.gSwordDir) == 0) { g_free(old_gSwordDir); } else { g_free(settings.gSwordDir); settings.gSwordDir = old_gSwordDir; } } + else + g_free(old_gSwordDir); /* --------------------------------------------------------------- */ -#endif /* if gSwordDir does not exist, create it. */ if (g_access(settings.gSwordDir, F_OK) == -1) {