changeset 102474:10dc40769985

* emacsclient.c (main): Revert part of last change, so drive-relative file names again work on Windows.
author Juanma Barranquero <lekktu@gmail.com>
date Wed, 11 Mar 2009 00:57:03 +0000
parents 1fff65a4070f
children 12f6840bd246
files lib-src/ChangeLog lib-src/emacsclient.c
diffstat 2 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/ChangeLog	Tue Mar 10 23:48:31 2009 +0000
+++ b/lib-src/ChangeLog	Wed Mar 11 00:57:03 2009 +0000
@@ -1,3 +1,8 @@
+2009-03-10  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacsclient.c (main): Revert part of last change, so
+	drive-relative file names again work on Windows.
+
 2009-03-10  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* emacsclient.c (main): Always pass cwd via "-dir".  Pass the file
--- a/lib-src/emacsclient.c	Tue Mar 10 23:48:31 2009 +0000
+++ b/lib-src/emacsclient.c	Wed Mar 11 00:57:03 2009 +0000
@@ -1635,6 +1635,26 @@
                   continue;
                 }
             }
+#ifdef WINDOWSNT
+	  else if (! file_name_absolute_p (argv[i])
+		   && (isalpha (argv[i][0]) && argv[i][1] == ':'))
+	    /* Windows can have a different default directory for each
+	       drive, so the cwd passed via "-dir" is not sufficient
+	       to account for that.
+	       If the user uses <drive>:<relpath>, we hence need to be
+	       careful to expand <relpath> with the default directory
+	       corresponding to <drive>.  */
+	    {
+	      char *filename = (char *) xmalloc (MAX_PATH);
+	      DWORD size;
+
+	      size = GetFullPathName (argv[i], MAX_PATH, filename, NULL);
+	      if (size > 0 && size < MAX_PATH)
+		argv[i] = filename;
+	      else
+		free (filename);
+	    }
+#endif
 
           send_to_emacs (emacs_socket, "-file ");
           quote_argument (emacs_socket, argv[i]);