mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
updated for version 7.0210
This commit is contained in:
23
src/fileio.c
23
src/fileio.c
@@ -2357,6 +2357,22 @@ failed:
|
|||||||
curbuf->b_op_start.col = 0;
|
curbuf->b_op_start.col = 0;
|
||||||
curbuf->b_op_end.lnum = from + linecnt;
|
curbuf->b_op_end.lnum = from + linecnt;
|
||||||
curbuf->b_op_end.col = 0;
|
curbuf->b_op_end.col = 0;
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
/*
|
||||||
|
* Work around a weird problem: When a file has two links (only
|
||||||
|
* possible on NTFS) and we write through one link, then stat() it
|
||||||
|
* throught the other link, the timestamp information may be wrong.
|
||||||
|
* It's correct again after reading the file, thus reset the timestamp
|
||||||
|
* here.
|
||||||
|
*/
|
||||||
|
if (newfile && !read_stdin && !read_buffer
|
||||||
|
&& mch_stat((char *)fname, &st) >= 0)
|
||||||
|
{
|
||||||
|
buf_store_time(curbuf, &st, fname);
|
||||||
|
curbuf->b_mtime_read = curbuf->b_mtime;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
msg_scroll = msg_save;
|
msg_scroll = msg_save;
|
||||||
|
|
||||||
@@ -3263,6 +3279,13 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
|
|||||||
)
|
)
|
||||||
backup_copy = TRUE;
|
backup_copy = TRUE;
|
||||||
else
|
else
|
||||||
|
# else
|
||||||
|
# ifdef WIN32
|
||||||
|
/* On NTFS file systems hard links are possible. */
|
||||||
|
if (mch_is_linked(fname))
|
||||||
|
backup_copy = TRUE;
|
||||||
|
else
|
||||||
|
# endif
|
||||||
# endif
|
# endif
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@@ -2547,6 +2547,61 @@ mch_isdir(char_u *name)
|
|||||||
return (f & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
return (f & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return TRUE if file "fname" has more than one link.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
mch_is_linked(char_u *fname)
|
||||||
|
{
|
||||||
|
HANDLE hFile;
|
||||||
|
int res = 0;
|
||||||
|
BY_HANDLE_FILE_INFORMATION inf;
|
||||||
|
#ifdef FEAT_MBYTE
|
||||||
|
WCHAR *wn = NULL;
|
||||||
|
|
||||||
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
|
wn = enc_to_ucs2(fname, NULL);
|
||||||
|
if (wn != NULL)
|
||||||
|
{
|
||||||
|
hFile = CreateFileW(wn, /* file name */
|
||||||
|
GENERIC_READ, /* access mode */
|
||||||
|
0, /* share mode */
|
||||||
|
NULL, /* security descriptor */
|
||||||
|
OPEN_EXISTING, /* creation disposition */
|
||||||
|
0, /* file attributes */
|
||||||
|
NULL); /* handle to template file */
|
||||||
|
if (hFile == INVALID_HANDLE_VALUE
|
||||||
|
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
||||||
|
{
|
||||||
|
/* Retry with non-wide function (for Windows 98). */
|
||||||
|
vim_free(wn);
|
||||||
|
wn = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (wn == NULL)
|
||||||
|
#endif
|
||||||
|
hFile = CreateFile(fname, /* file name */
|
||||||
|
GENERIC_READ, /* access mode */
|
||||||
|
0, /* share mode */
|
||||||
|
NULL, /* security descriptor */
|
||||||
|
OPEN_EXISTING, /* creation disposition */
|
||||||
|
0, /* file attributes */
|
||||||
|
NULL); /* handle to template file */
|
||||||
|
|
||||||
|
if (hFile != INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
if (GetFileInformationByHandle(hFile, &inf) != 0
|
||||||
|
&& inf.nNumberOfLinks > 1)
|
||||||
|
res = 1;
|
||||||
|
CloseHandle(hFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef FEAT_MBYTE
|
||||||
|
vim_free(wn);
|
||||||
|
#endif
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return TRUE if file or directory "name" is writable (not readonly).
|
* Return TRUE if file or directory "name" is writable (not readonly).
|
||||||
* Strange semantics of Win32: a readonly directory is writable, but you can't
|
* Strange semantics of Win32: a readonly directory is writable, but you can't
|
||||||
|
@@ -7,6 +7,7 @@ int u_savedel __ARGS((linenr_T lnum, long nlines));
|
|||||||
void u_undo __ARGS((int count));
|
void u_undo __ARGS((int count));
|
||||||
void u_redo __ARGS((int count));
|
void u_redo __ARGS((int count));
|
||||||
void u_sync __ARGS((void));
|
void u_sync __ARGS((void));
|
||||||
|
void ex_undojoin __ARGS((exarg_T *eap));
|
||||||
void u_unchanged __ARGS((buf_T *buf));
|
void u_unchanged __ARGS((buf_T *buf));
|
||||||
void u_clearall __ARGS((buf_T *buf));
|
void u_clearall __ARGS((buf_T *buf));
|
||||||
void u_saveline __ARGS((linenr_T lnum));
|
void u_saveline __ARGS((linenr_T lnum));
|
||||||
|
Reference in New Issue
Block a user