Merge pull request #13054 from erw7/fix-msg-is-a-directory-on-Windows

fileio: fix "is a directory" warning on Windows
This commit is contained in:
Thomas Vigouroux 2020-10-06 09:20:28 +02:00 committed by GitHub
commit 753a86c01a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 14 deletions

View File

@ -470,7 +470,6 @@ readfile(
if (!read_buffer && !read_stdin && !read_fifo) { if (!read_buffer && !read_stdin && !read_fifo) {
perm = os_getperm((const char *)fname); perm = os_getperm((const char *)fname);
#ifdef UNIX
// On Unix it is possible to read a directory, so we have to // On Unix it is possible to read a directory, so we have to
// check for it before os_open(). // check for it before os_open().
if (perm >= 0 && !S_ISREG(perm) // not a regular file ... if (perm >= 0 && !S_ISREG(perm) // not a regular file ...
@ -494,7 +493,6 @@ readfile(
msg_scroll = msg_save; msg_scroll = msg_save;
return S_ISDIR(perm) ? NOTDONE : FAIL; return S_ISDIR(perm) ? NOTDONE : FAIL;
} }
#endif
} }
/* Set default or forced 'fileformat' and 'binary'. */ /* Set default or forced 'fileformat' and 'binary'. */
@ -553,13 +551,6 @@ readfile(
if (fd < 0) { // cannot open at all if (fd < 0) { // cannot open at all
msg_scroll = msg_save; msg_scroll = msg_save;
#ifndef UNIX
// On non-unix systems we can't open a directory, check here.
if (os_isdir(fname)) {
filemess(curbuf, sfname, (char_u *)_(msg_is_a_directory), 0);
curbuf->b_p_ro = true; // must use "w!" now
} else {
#endif
if (!newfile) { if (!newfile) {
return FAIL; return FAIL;
} }
@ -617,9 +608,6 @@ readfile(
return FAIL; return FAIL;
} }
#ifndef UNIX
}
#endif
/* /*
* Only set the 'ro' flag for readonly files the first time they are * Only set the 'ro' flag for readonly files the first time they are

View File

@ -1536,10 +1536,8 @@ func Test_edit_noesckeys()
endfunc endfunc
" Test for editing a directory " Test for editing a directory
" Todo: "is a directory" message is not displayed in Windows.
func Test_edit_is_a_directory() func Test_edit_is_a_directory()
CheckEnglish CheckEnglish
CheckNotMSWindows
let dirname = getcwd() . "/Xdir" let dirname = getcwd() . "/Xdir"
call mkdir(dirname, 'p') call mkdir(dirname, 'p')