Karsten Hopp eea982
To: vim_dev@googlegroups.com
Karsten Hopp eea982
Subject: Patch 7.4.906
Karsten Hopp eea982
Fcc: outbox
Karsten Hopp eea982
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp eea982
Mime-Version: 1.0
Karsten Hopp eea982
Content-Type: text/plain; charset=UTF-8
Karsten Hopp eea982
Content-Transfer-Encoding: 8bit
Karsten Hopp eea982
------------
Karsten Hopp eea982
Karsten Hopp eea982
Patch 7.4.906
Karsten Hopp eea982
Problem:    On MS-Windows the viminfo file is (always) given the hidden
Karsten Hopp eea982
            attribute. (raulnac)
Karsten Hopp eea982
Solution:   Check the hidden attribute in a different way. (Ken Takata)
Karsten Hopp eea982
Files:      src/ex_cmds.c, src/os_win32.c, src/os_win32.pro
Karsten Hopp eea982
Karsten Hopp eea982
Karsten Hopp eea982
*** ../vim-7.4.905/src/ex_cmds.c	2015-08-11 19:13:55.134175736 +0200
Karsten Hopp eea982
--- src/ex_cmds.c	2015-11-02 14:32:36.072850890 +0100
Karsten Hopp eea982
***************
Karsten Hopp eea982
*** 1795,1801 ****
Karsten Hopp eea982
      struct stat	st_old;		/* mch_stat() of existing viminfo file */
Karsten Hopp eea982
  #endif
Karsten Hopp eea982
  #ifdef WIN3264
Karsten Hopp eea982
!     long	perm = -1;
Karsten Hopp eea982
  #endif
Karsten Hopp eea982
  
Karsten Hopp eea982
      if (no_viminfo())
Karsten Hopp eea982
--- 1795,1801 ----
Karsten Hopp eea982
      struct stat	st_old;		/* mch_stat() of existing viminfo file */
Karsten Hopp eea982
  #endif
Karsten Hopp eea982
  #ifdef WIN3264
Karsten Hopp eea982
!     int		hidden = FALSE;
Karsten Hopp eea982
  #endif
Karsten Hopp eea982
  
Karsten Hopp eea982
      if (no_viminfo())
Karsten Hopp eea982
***************
Karsten Hopp eea982
*** 1858,1864 ****
Karsten Hopp eea982
  #endif
Karsten Hopp eea982
  #ifdef WIN3264
Karsten Hopp eea982
  	/* Get the file attributes of the existing viminfo file. */
Karsten Hopp eea982
! 	perm = mch_getperm(fname);
Karsten Hopp eea982
  #endif
Karsten Hopp eea982
  
Karsten Hopp eea982
  	/*
Karsten Hopp eea982
--- 1858,1864 ----
Karsten Hopp eea982
  #endif
Karsten Hopp eea982
  #ifdef WIN3264
Karsten Hopp eea982
  	/* Get the file attributes of the existing viminfo file. */
Karsten Hopp eea982
! 	hidden = mch_ishidden(fname);
Karsten Hopp eea982
  #endif
Karsten Hopp eea982
  
Karsten Hopp eea982
  	/*
Karsten Hopp eea982
***************
Karsten Hopp eea982
*** 2033,2039 ****
Karsten Hopp eea982
  
Karsten Hopp eea982
  #ifdef WIN3264
Karsten Hopp eea982
  	/* If the viminfo file was hidden then also hide the new file. */
Karsten Hopp eea982
! 	if (perm > 0 && (perm & FILE_ATTRIBUTE_HIDDEN))
Karsten Hopp eea982
  	    mch_hide(fname);
Karsten Hopp eea982
  #endif
Karsten Hopp eea982
      }
Karsten Hopp eea982
--- 2033,2039 ----
Karsten Hopp eea982
  
Karsten Hopp eea982
  #ifdef WIN3264
Karsten Hopp eea982
  	/* If the viminfo file was hidden then also hide the new file. */
Karsten Hopp eea982
! 	if (hidden)
Karsten Hopp eea982
  	    mch_hide(fname);
Karsten Hopp eea982
  #endif
Karsten Hopp eea982
      }
Karsten Hopp eea982
*** ../vim-7.4.905/src/os_win32.c	2015-10-30 16:46:50.504694378 +0100
Karsten Hopp eea982
--- src/os_win32.c	2015-11-02 14:43:50.916893452 +0100
Karsten Hopp eea982
***************
Karsten Hopp eea982
*** 3098,3103 ****
Karsten Hopp eea982
--- 3098,3117 ----
Karsten Hopp eea982
  }
Karsten Hopp eea982
  
Karsten Hopp eea982
  /*
Karsten Hopp eea982
+  * Return TRUE if file "name" exists and is hidden.
Karsten Hopp eea982
+  */
Karsten Hopp eea982
+     int
Karsten Hopp eea982
+ mch_ishidden(char_u *name)
Karsten Hopp eea982
+ {
Karsten Hopp eea982
+     int f = win32_getattrs(name);
Karsten Hopp eea982
+ 
Karsten Hopp eea982
+     if (f == -1)
Karsten Hopp eea982
+ 	return FALSE;		    /* file does not exist at all */
Karsten Hopp eea982
+ 
Karsten Hopp eea982
+     return (f & FILE_ATTRIBUTE_HIDDEN) != 0;
Karsten Hopp eea982
+ }
Karsten Hopp eea982
+ 
Karsten Hopp eea982
+ /*
Karsten Hopp eea982
   * return TRUE if "name" is a directory
Karsten Hopp eea982
   * return FALSE if "name" is not a directory or upon error
Karsten Hopp eea982
   */
Karsten Hopp eea982
*** ../vim-7.4.905/src/version.c	2015-11-02 13:28:43.577894118 +0100
Karsten Hopp eea982
--- src/version.c	2015-11-02 14:35:23.938871147 +0100
Karsten Hopp eea982
***************
Karsten Hopp eea982
*** 743,744 ****
Karsten Hopp eea982
--- 743,746 ----
Karsten Hopp eea982
  {   /* Add new patch number below this line */
Karsten Hopp eea982
+ /**/
Karsten Hopp eea982
+     906,
Karsten Hopp eea982
  /**/
Karsten Hopp eea982
Karsten Hopp eea982
-- 
Karsten Hopp eea982
hundred-and-one symptoms of being an internet addict:
Karsten Hopp eea982
81. At social functions you introduce your husband as "my domain server."
Karsten Hopp eea982
Karsten Hopp eea982
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp eea982
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp eea982
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp eea982
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///