Fixed user defined home dir, if home dir contain tilda (~/)

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2011-12-09 23:19:37 +03:00
parent 44de4d1b1f
commit 1dffc24f9b
3 changed files with 14 additions and 7 deletions

View File

@ -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:
- - - - - -

View File

@ -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);

View File

@ -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