Skip to content

Commit 8a52ba7

Browse files
committed
patch 7.4.906
Problem: On MS-Windows the viminfo file is (always) given the hidden attribute. (raulnac) Solution: Check the hidden attribute in a different way. (Ken Takata)
1 parent 1d8d9c0 commit 8a52ba7

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

src/ex_cmds.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,7 +1795,7 @@ write_viminfo(file, forceit)
17951795
struct stat st_old; /* mch_stat() of existing viminfo file */
17961796
#endif
17971797
#ifdef WIN3264
1798-
long perm = -1;
1798+
int hidden = FALSE;
17991799
#endif
18001800

18011801
if (no_viminfo())
@@ -1858,7 +1858,7 @@ write_viminfo(file, forceit)
18581858
#endif
18591859
#ifdef WIN3264
18601860
/* Get the file attributes of the existing viminfo file. */
1861-
perm = mch_getperm(fname);
1861+
hidden = mch_ishidden(fname);
18621862
#endif
18631863

18641864
/*
@@ -2033,7 +2033,7 @@ write_viminfo(file, forceit)
20332033

20342034
#ifdef WIN3264
20352035
/* If the viminfo file was hidden then also hide the new file. */
2036-
if (perm > 0 && (perm & FILE_ATTRIBUTE_HIDDEN))
2036+
if (hidden)
20372037
mch_hide(fname);
20382038
#endif
20392039
}

src/os_win32.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3097,6 +3097,20 @@ mch_hide(char_u *name)
30973097
win32_setattrs(name, attrs);
30983098
}
30993099

3100+
/*
3101+
* Return TRUE if file "name" exists and is hidden.
3102+
*/
3103+
int
3104+
mch_ishidden(char_u *name)
3105+
{
3106+
int f = win32_getattrs(name);
3107+
3108+
if (f == -1)
3109+
return FALSE; /* file does not exist at all */
3110+
3111+
return (f & FILE_ATTRIBUTE_HIDDEN) != 0;
3112+
}
3113+
31003114
/*
31013115
* return TRUE if "name" is a directory
31023116
* return FALSE if "name" is not a directory or upon error

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
906,
744746
/**/
745747
905,
746748
/**/

0 commit comments

Comments
 (0)