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