Merge pull request #12047 from erw7/fix-resolve-on-windows

Change resolve() to resolve symbolic links on Windows
Neovim worked the same way as vim for shortcuts, but didn't handle symbolic links and junction cases. This PR implements the same behavior for symbolic links and junctions as for vim.
This commit is contained in:
Matthieu Coudron
2020-04-19 14:11:01 +02:00
committed by GitHub
2 changed files with 75 additions and 1 deletions

View File

@@ -6722,7 +6722,12 @@ static void f_resolve(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->v_type = VAR_STRING;
const char *fname = tv_get_string(&argvars[0]);
#ifdef WIN32
char *const v = os_resolve_shortcut(fname);
char *v = os_resolve_shortcut(fname);
if (v == NULL) {
if (os_is_reparse_point_include(fname)) {
v = os_realpath(fname, v);
}
}
rettv->vval.v_string = (char_u *)(v == NULL ? xstrdup(fname) : v);
#else
# ifdef HAVE_READLINK