0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.1.0211: expanding a file name "~" results in $HOME

Problem:    Expanding a file name "~" results in $HOME. (Aidan Shafran)
Solution:   Change "~" to "./~" before expanding. (closes #3072)
This commit is contained in:
Bram Moolenaar
2018-07-25 21:19:13 +02:00
parent 6f8d2ac6f1
commit 00136dc321
8 changed files with 29 additions and 11 deletions

View File

@@ -9690,11 +9690,12 @@ shortpath_for_partial(
*/
int
modify_fname(
char_u *src, /* string with modifiers */
int *usedlen, /* characters after src that are used */
char_u **fnamep, /* file name so far */
char_u **bufp, /* buffer for allocated file name or NULL */
int *fnamelen) /* length of fnamep */
char_u *src, // string with modifiers
int tilde_file, // "~" is a file name, not $HOME
int *usedlen, // characters after src that are used
char_u **fnamep, // file name so far
char_u **bufp, // buffer for allocated file name or NULL
int *fnamelen) // length of fnamep
{
int valid = 0;
char_u *tail;
@@ -9724,8 +9725,8 @@ repeat:
|| (*fnamep)[1] == '\\'
# endif
|| (*fnamep)[1] == NUL)
#endif
&& !(tilde_file && (*fnamep)[1] == NUL)
)
{
*fnamep = expand_env_save(*fnamep);