Karsten Hopp 21fdda
To: vim_dev@googlegroups.com
Karsten Hopp 21fdda
Subject: Patch 7.3.559
Karsten Hopp 21fdda
Fcc: outbox
Karsten Hopp 21fdda
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 21fdda
Mime-Version: 1.0
Karsten Hopp 21fdda
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 21fdda
Content-Transfer-Encoding: 8bit
Karsten Hopp 21fdda
------------
Karsten Hopp 21fdda
Karsten Hopp 21fdda
Patch 7.3.559
Karsten Hopp 21fdda
Problem:    home_replace() does not work with 8.3 filename.
Karsten Hopp 21fdda
Solution:   Make ":p" expand 8.3 name to full path. (Yasuhiro Matsumoto)
Karsten Hopp 21fdda
Files:	    src/eval.c, src/misc1.c
Karsten Hopp 21fdda
Karsten Hopp 21fdda
Karsten Hopp 21fdda
*** ../vim-7.3.558/src/eval.c	2012-06-13 14:28:16.000000000 +0200
Karsten Hopp 21fdda
--- src/eval.c	2012-06-20 13:52:47.000000000 +0200
Karsten Hopp 21fdda
***************
Karsten Hopp 21fdda
*** 23554,23559 ****
Karsten Hopp 21fdda
--- 23554,23580 ----
Karsten Hopp 21fdda
  		return -1;
Karsten Hopp 21fdda
  	}
Karsten Hopp 21fdda
  
Karsten Hopp 21fdda
+ #ifdef WIN3264
Karsten Hopp 21fdda
+ # if _WIN32_WINNT >= 0x0500
Karsten Hopp 21fdda
+ 	if (vim_strchr(*fnamep, '~') != NULL)
Karsten Hopp 21fdda
+ 	{
Karsten Hopp 21fdda
+ 	    /* Expand 8.3 filename to full path.  Needed to make sure the same
Karsten Hopp 21fdda
+ 	     * file does not have two different names.
Karsten Hopp 21fdda
+ 	     * Note: problem does not occur if _WIN32_WINNT < 0x0500. */
Karsten Hopp 21fdda
+ 	    p = alloc(_MAX_PATH + 1);
Karsten Hopp 21fdda
+ 	    if (p != NULL)
Karsten Hopp 21fdda
+ 	    {
Karsten Hopp 21fdda
+ 		if (GetLongPathName(*fnamep, p, MAXPATHL))
Karsten Hopp 21fdda
+ 		{
Karsten Hopp 21fdda
+ 		    vim_free(*bufp);
Karsten Hopp 21fdda
+ 		    *bufp = *fnamep = p;
Karsten Hopp 21fdda
+ 		}
Karsten Hopp 21fdda
+ 		else
Karsten Hopp 21fdda
+ 		    vim_free(p);
Karsten Hopp 21fdda
+ 	    }
Karsten Hopp 21fdda
+ 	}
Karsten Hopp 21fdda
+ # endif
Karsten Hopp 21fdda
+ #endif
Karsten Hopp 21fdda
  	/* Append a path separator to a directory. */
Karsten Hopp 21fdda
  	if (mch_isdir(*fnamep))
Karsten Hopp 21fdda
  	{
Karsten Hopp 21fdda
*** ../vim-7.3.558/src/misc1.c	2012-06-20 12:40:01.000000000 +0200
Karsten Hopp 21fdda
--- src/misc1.c	2012-06-20 13:57:22.000000000 +0200
Karsten Hopp 21fdda
***************
Karsten Hopp 21fdda
*** 4499,4505 ****
Karsten Hopp 21fdda
  {
Karsten Hopp 21fdda
      size_t	dirlen = 0, envlen = 0;
Karsten Hopp 21fdda
      size_t	len;
Karsten Hopp 21fdda
!     char_u	*homedir_env;
Karsten Hopp 21fdda
      char_u	*p;
Karsten Hopp 21fdda
  
Karsten Hopp 21fdda
      if (src == NULL)
Karsten Hopp 21fdda
--- 4499,4505 ----
Karsten Hopp 21fdda
  {
Karsten Hopp 21fdda
      size_t	dirlen = 0, envlen = 0;
Karsten Hopp 21fdda
      size_t	len;
Karsten Hopp 21fdda
!     char_u	*homedir_env, *homedir_env_orig;
Karsten Hopp 21fdda
      char_u	*p;
Karsten Hopp 21fdda
  
Karsten Hopp 21fdda
      if (src == NULL)
Karsten Hopp 21fdda
***************
Karsten Hopp 21fdda
*** 4525,4533 ****
Karsten Hopp 21fdda
  	dirlen = STRLEN(homedir);
Karsten Hopp 21fdda
  
Karsten Hopp 21fdda
  #ifdef VMS
Karsten Hopp 21fdda
!     homedir_env = mch_getenv((char_u *)"SYS$LOGIN");
Karsten Hopp 21fdda
  #else
Karsten Hopp 21fdda
!     homedir_env = mch_getenv((char_u *)"HOME");
Karsten Hopp 21fdda
  #endif
Karsten Hopp 21fdda
  
Karsten Hopp 21fdda
      if (homedir_env != NULL && *homedir_env == NUL)
Karsten Hopp 21fdda
--- 4525,4548 ----
Karsten Hopp 21fdda
  	dirlen = STRLEN(homedir);
Karsten Hopp 21fdda
  
Karsten Hopp 21fdda
  #ifdef VMS
Karsten Hopp 21fdda
!     homedir_env_orig = homedir_env = mch_getenv((char_u *)"SYS$LOGIN");
Karsten Hopp 21fdda
  #else
Karsten Hopp 21fdda
!     homedir_env_orig = homedir_env = mch_getenv((char_u *)"HOME");
Karsten Hopp 21fdda
! #endif
Karsten Hopp 21fdda
! #if defined(FEAT_MODIFY_FNAME) || defined(WIN3264)
Karsten Hopp 21fdda
!     if (vim_strchr(homedir_env, '~') != NULL)
Karsten Hopp 21fdda
!     {
Karsten Hopp 21fdda
! 	int	usedlen = 0;
Karsten Hopp 21fdda
! 	int	flen;
Karsten Hopp 21fdda
! 	char_u	*fbuf = NULL;
Karsten Hopp 21fdda
! 
Karsten Hopp 21fdda
! 	flen = (int)STRLEN(homedir_env);
Karsten Hopp 21fdda
! 	(void)modify_fname(":p", &usedlen, &homedir_env, &fbuf, &flen);
Karsten Hopp 21fdda
! 	flen = (int)STRLEN(homedir_env);
Karsten Hopp 21fdda
! 	if (flen > 0 && vim_ispathsep(homedir_env[flen - 1]))
Karsten Hopp 21fdda
! 	    /* Remove the trailing / that is added to a directory. */
Karsten Hopp 21fdda
! 	    homedir_env[flen - 1] = NUL;
Karsten Hopp 21fdda
!     }
Karsten Hopp 21fdda
  #endif
Karsten Hopp 21fdda
  
Karsten Hopp 21fdda
      if (homedir_env != NULL && *homedir_env == NUL)
Karsten Hopp 21fdda
***************
Karsten Hopp 21fdda
*** 4585,4590 ****
Karsten Hopp 21fdda
--- 4600,4608 ----
Karsten Hopp 21fdda
      /* if (dstlen == 0) out of space, what to do??? */
Karsten Hopp 21fdda
  
Karsten Hopp 21fdda
      *dst = NUL;
Karsten Hopp 21fdda
+ 
Karsten Hopp 21fdda
+     if (homedir_env != homedir_env_orig)
Karsten Hopp 21fdda
+ 	vim_free(homedir_env);
Karsten Hopp 21fdda
  }
Karsten Hopp 21fdda
  
Karsten Hopp 21fdda
  /*
Karsten Hopp 21fdda
*** ../vim-7.3.558/src/version.c	2012-06-20 12:40:01.000000000 +0200
Karsten Hopp 21fdda
--- src/version.c	2012-06-20 14:02:11.000000000 +0200
Karsten Hopp 21fdda
***************
Karsten Hopp 21fdda
*** 716,717 ****
Karsten Hopp 21fdda
--- 716,719 ----
Karsten Hopp 21fdda
  {   /* Add new patch number below this line */
Karsten Hopp 21fdda
+ /**/
Karsten Hopp 21fdda
+     559,
Karsten Hopp 21fdda
  /**/
Karsten Hopp 21fdda
Karsten Hopp 21fdda
-- 
Karsten Hopp 21fdda
The future isn't what it used to be.
Karsten Hopp 21fdda
Karsten Hopp 21fdda
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 21fdda
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 21fdda
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 21fdda
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///