// 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);
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)
call assert_equal('tar', fnamemodify('abc.fb2.tar.gz', ':e:e:r'))
let cwd = getcwd()
+ call chdir($HOME)
+ call assert_equal('foobar', fnamemodify('~/foobar', ':~:.'))
+ call chdir(cwd)
call mkdir($HOME . '/XXXXXXXX/a', 'p')
call mkdir($HOME . '/XXXXXXXX/b', 'p')
call chdir($HOME . '/XXXXXXXX/a/')