Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.4.906
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

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)
Files:      src/ex_cmds.c, src/os_win32.c, src/os_win32.pro


*** ../vim-7.4.905/src/ex_cmds.c	2015-08-11 19:13:55.134175736 +0200
--- src/ex_cmds.c	2015-11-02 14:32:36.072850890 +0100
***************
*** 1795,1801 ****
      struct stat	st_old;		/* mch_stat() of existing viminfo file */
  #endif
  #ifdef WIN3264
!     long	perm = -1;
  #endif
  
      if (no_viminfo())
--- 1795,1801 ----
      struct stat	st_old;		/* mch_stat() of existing viminfo file */
  #endif
  #ifdef WIN3264
!     int		hidden = FALSE;
  #endif
  
      if (no_viminfo())
***************
*** 1858,1864 ****
  #endif
  #ifdef WIN3264
  	/* Get the file attributes of the existing viminfo file. */
! 	perm = mch_getperm(fname);
  #endif
  
  	/*
--- 1858,1864 ----
  #endif
  #ifdef WIN3264
  	/* Get the file attributes of the existing viminfo file. */
! 	hidden = mch_ishidden(fname);
  #endif
  
  	/*
***************
*** 2033,2039 ****
  
  #ifdef WIN3264
  	/* If the viminfo file was hidden then also hide the new file. */
! 	if (perm > 0 && (perm & FILE_ATTRIBUTE_HIDDEN))
  	    mch_hide(fname);
  #endif
      }
--- 2033,2039 ----
  
  #ifdef WIN3264
  	/* If the viminfo file was hidden then also hide the new file. */
! 	if (hidden)
  	    mch_hide(fname);
  #endif
      }
*** ../vim-7.4.905/src/os_win32.c	2015-10-30 16:46:50.504694378 +0100
--- src/os_win32.c	2015-11-02 14:43:50.916893452 +0100
***************
*** 3098,3103 ****
--- 3098,3117 ----
  }
  
  /*
+  * Return TRUE if file "name" exists and is hidden.
+  */
+     int
+ mch_ishidden(char_u *name)
+ {
+     int f = win32_getattrs(name);
+ 
+     if (f == -1)
+ 	return FALSE;		    /* file does not exist at all */
+ 
+     return (f & FILE_ATTRIBUTE_HIDDEN) != 0;
+ }
+ 
+ /*
   * return TRUE if "name" is a directory
   * return FALSE if "name" is not a directory or upon error
   */
*** ../vim-7.4.905/src/version.c	2015-11-02 13:28:43.577894118 +0100
--- src/version.c	2015-11-02 14:35:23.938871147 +0100
***************
*** 743,744 ****
--- 743,746 ----
  {   /* Add new patch number below this line */
+ /**/
+     906,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
81. At social functions you introduce your husband as "my domain server."

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///