1
0
forked from aniani/vim

patch 8.2.4060: win_execute() slow on systems where getcwd()/chdir() is slow

Problem:    win_execute() is slow on systems where getcwd() or chdir() is
            slow. (Rick Howe)
Solution:   Avoid using getcwd() and chdir() if no local directory is used and
            'acd' is not set. (closes #9504)
This commit is contained in:
Bram Moolenaar
2022-01-11 12:37:20 +00:00
parent 19db9e6ba7
commit d6f27c66cc
2 changed files with 17 additions and 2 deletions

View File

@@ -707,12 +707,25 @@ f_win_execute(typval_T *argvars, typval_T *rettv)
{
pos_T curpos = wp->w_cursor;
char_u cwd[MAXPATHL];
int cwd_status;
int cwd_status = FAIL;
#ifdef FEAT_AUTOCHDIR
char_u autocwd[MAXPATHL];
int apply_acd = FALSE;
#endif
// Getting and setting directory can be slow on some systems, only do
// this when the current or target window/tab have a local directory or
// 'acd' is set.
if (curwin != wp
&& (curwin->w_localdir != NULL
|| wp->w_localdir != NULL
|| (curtab != tp
&& (curtab->tp_localdir != NULL
|| tp->tp_localdir != NULL))
#ifdef FEAT_AUTOCHDIR
|| p_acd
#endif
))
cwd_status = mch_dirname(cwd, MAXPATHL);
#ifdef FEAT_AUTOCHDIR

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4060,
/**/
4059,
/**/