From dd9c7516a383707d504eb0dca2dc9b24d8f4ff07 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Mon, 12 Mar 2012 10:48:41 +0300 Subject: [PATCH] Support of use ~ as home directory in hotlist. Expand tilde while vfs path canonicalize. Signed-off-by: Andrew Borodin --- lib/vfs/path.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/vfs/path.c b/lib/vfs/path.c index d758d6a9e..9d3be50a8 100644 --- a/lib/vfs/path.c +++ b/lib/vfs/path.c @@ -134,17 +134,24 @@ _vfs_split_with_semi_skip_count (char *path, const char **inpath, const char **o static char * vfs_canon (const char *path) { - if (!path) + if (path == NULL) vfs_die ("Cannot canonicalize NULL"); /* Relative to current directory */ if (*path != PATH_SEP) { - char *local, *result, *curr_dir; + char *result, *local; - curr_dir = vfs_get_current_dir (); - local = mc_build_filename (curr_dir, path, NULL); - g_free (curr_dir); + local = tilde_expand (path); + if (*local != PATH_SEP) + { + char *curr_dir; + + g_free (local); + curr_dir = vfs_get_current_dir (); + local = mc_build_filename (curr_dir, path, NULL); + g_free (curr_dir); + } result = vfs_canon (local); g_free (local); @@ -156,7 +163,9 @@ vfs_canon (const char *path) * /p1/p2#op/.././././p3#op/p4. Good luck. */ { - char *result = g_strdup (path); + char *result; + + result = g_strdup (path); canonicalize_pathname (result); return result; } -- 2.11.4.GIT