vim-patch:8.1.2180: Error E303 is not useful when 'directory' is empty (#11257)

Problem:    Error E303 is not useful when 'directory' is empty.
Solution:   Skip the error message. (Daniel Hahler, vim/vim#5067)
00e192becd
This commit is contained in:
Daniel Hahler
2019-10-19 23:11:31 +02:00
committed by Justin M. Keyes
parent 68b0873c45
commit 3de4dc539a
4 changed files with 12 additions and 5 deletions

View File

@@ -523,9 +523,9 @@ void ml_open_file(buf_T *buf)
}
}
if (mfp->mf_fname == NULL) { /* Failed! */
need_wait_return = TRUE; /* call wait_return later */
++no_wait_return;
if (*p_dir != NUL && mfp->mf_fname == NULL) {
need_wait_return = true; // call wait_return later
no_wait_return++;
(void)EMSG2(_(
"E303: Unable to open swap file for \"%s\", recovery impossible"),
buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname);

View File

@@ -14,6 +14,12 @@ func Test_recover_root_dir()
set dir=/notexist/
endif
call assert_fails('split Xtest', 'E303:')
" No error with empty 'directory' setting.
set directory=
split XtestOK
close!
set dir&
endfunc