From 1dffc24f9be3472477ac203ae3e31c2d593f2a9c Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Fri, 9 Dec 2011 23:19:37 +0300 Subject: [PATCH] Fixed user defined home dir, if home dir contain tilda (~/) Signed-off-by: Slava Zanko --- doc/INSTALL | 5 +++-- lib/mcconfig/paths.c | 14 ++++++++++---- src/filemanager/hotlist.c | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/doc/INSTALL b/doc/INSTALL index 6c64e1959..500f67177 100644 --- a/doc/INSTALL +++ b/doc/INSTALL @@ -141,8 +141,9 @@ incomplete, use `configure --help' to get the full list): `--with-homedir' This option allow users to place user config directories in any place. By default value is 'XDG', this mean, mc will respect XDG - standards. If other value will specified, this will used as directory - name (relative to $HOME). + standards. If other value is specified, this will used as directory + name (relative to $HOME if path is relative, or as is if path is + absolute). VFS options: - - - - - - diff --git a/lib/mcconfig/paths.c b/lib/mcconfig/paths.c index f9f883b4e..d6971ff30 100644 --- a/lib/mcconfig/paths.c +++ b/lib/mcconfig/paths.c @@ -301,11 +301,17 @@ mc_config_init_config_paths (GError ** error) mc_config_fix_migrated_rules (); #else /* MC_HOMEDIR_XDG */ - char *u_config_dir = g_build_filename (mc_config_get_home_dir (), MC_USERCONF_DIR, NULL); + char *defined_userconf_dir; + char *u_config_dir; - u_config_dir = (u_config_dir == NULL) - ? g_build_filename (mc_config_get_home_dir (), MC_OLD_USERCONF_DIR, - NULL) : g_strdup (u_config_dir); + defined_userconf_dir = tilde_expand (MC_USERCONF_DIR); + if (!g_path_is_absolute (defined_userconf_dir)) + { + u_config_dir = g_build_filename (mc_config_get_home_dir (), MC_USERCONF_DIR, NULL); + g_free (defined_userconf_dir); + } + else + u_config_dir = defined_userconf_dir; mc_data_str = mc_cache_str = mc_config_str = mc_config_init_one_config_path (u_config_dir, "", error); diff --git a/src/filemanager/hotlist.c b/src/filemanager/hotlist.c index 1c4613d7e..492616be2 100644 --- a/src/filemanager/hotlist.c +++ b/src/filemanager/hotlist.c @@ -1593,7 +1593,7 @@ load_hotlist (void) else message (D_ERROR, _("Hotlist Load"), _ - ("MC was unable to write ~/%s file,\nyour old hotlist entries were not deleted"), + ("MC was unable to write %s file,\nyour old hotlist entries were not deleted"), MC_USERCONF_DIR PATH_SEP_STR MC_HOTLIST_FILE); } else