To: vim-dev@vim.org
Subject: Patch 6.0.114
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 6.0.114
Problem:    Using ":p" with fnamemodify() didn't expand "~/" or "~user/" to a
	    full path.  For Win32 the current directory was prepended.
	    (Michael Geddes)
Solution:   Expand the home directory.
Files:	    src/eval.c


*** ../vim60.113/src/eval.c	Mon Dec 31 16:39:26 2001
--- src/eval.c	Tue Jan  1 15:09:37 2002
***************
*** 8564,8571 ****
      {
  	valid |= VALID_PATH;
  	*usedlen += 2;
  	/* FullName_save() is slow, don't use it when not needed. */
! 	if (!vim_isAbsName(*fnamep))
  	{
  	    *fnamep = FullName_save(*fnamep, FALSE);
  	    vim_free(*bufp);	/* free any allocated file name */
--- 8564,8590 ----
      {
  	valid |= VALID_PATH;
  	*usedlen += 2;
+ 
+ 	/* Expand "~/path" for all systems and "~user/path" for Unix and VMS */
+ 	if ((*fnamep)[0] == '~'
+ #if !defined(UNIX) && !(defined(VMS) && defined(USER_HOME))
+ 		&& ((*fnamep)[1] == '/'
+ # ifdef BACKSLASH_IN_FILENAME
+ 		    || (*fnamep)[1] == '\\'
+ # endif
+ 		    || (*fnamep)[1] == NUL)
+ 
+ #endif
+ 	   )
+ 	{
+ 	    *fnamep = expand_env_save(*fnamep);
+ 	    vim_free(*bufp);	/* free any allocated file name */
+ 	    *bufp = *fnamep;
+ 	    if (*fnamep == NULL)
+ 		return -1;
+ 	}
  	/* FullName_save() is slow, don't use it when not needed. */
! 	else if (!vim_isAbsName(*fnamep))
  	{
  	    *fnamep = FullName_save(*fnamep, FALSE);
  	    vim_free(*bufp);	/* free any allocated file name */
*** ../vim60.113/src/version.c	Mon Dec 31 17:47:49 2001
--- src/version.c	Tue Jan  1 15:14:01 2002
***************
*** 608,609 ****
--- 608,611 ----
  {   /* Add new patch number below this line */
+ /**/
+     114,
  /**/

-- 
Microsoft's definition of a boolean: TRUE, FALSE, MAYBE
"Embrace and extend"...?

 ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
(((   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   )))
 \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///