summaryrefslogtreecommitdiffstats
path: root/src/filepath.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-06-10 13:12:28 +0200
committerBram Moolenaar <Bram@vim.org>2020-06-10 13:12:28 +0200
commit0e390f40e944036fb558a63b91238cfda128d95f (patch)
treea0cfb553a4eb3b22df2f70bb5196cebe304a07d4 /src/filepath.c
parent517f00f78893087d2f9d45768a5ba4dc48cb6856 (diff)
patch 8.2.0942: expanding to local dir after homedir keeps "~/"v8.2.0942
Problem: Expanding to local dir after homedir keeps "~/". Solution: Adjust modify_fname(). (Christian Brabandt, closes #6205, closes #5979)
Diffstat (limited to 'src/filepath.c')
-rw-r--r--src/filepath.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/filepath.c b/src/filepath.c
index 8bc941d354..4a4948ad6e 100644
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -416,7 +416,7 @@ repeat:
// Need full path first (use expand_env() to remove a "~/")
if (!has_fullname && !has_homerelative)
{
- if (c == '.' && **fnamep == '~')
+ if ((c == '.' || c == '~') && **fnamep == '~')
p = pbuf = expand_env_save(*fnamep);
else
p = pbuf = FullName_save(*fnamep, FALSE);
@@ -2397,11 +2397,9 @@ home_replace(
if (--dstlen > 0)
*dst++ = '~';
- /*
- * If it's just the home directory, add "/".
- */
- if (!vim_ispathsep(src[0]) && --dstlen > 0)
- *dst++ = '/';
+ // Do not add directory separator into dst, because dst is
+ // expected to just return the directory name without the
+ // directory separator '/'.
break;
}
if (p == homedir_env)