]> code.delx.au - gnu-emacs/blobdiff - src/w32proc.c
Fix Qnone definition in NS files.
[gnu-emacs] / src / w32proc.c
index 33981445c7ca3cceef46c737155525500d959fcd..9d4d58f123035a9b2e729b2f5145fbfdfbad1aa5 100644 (file)
@@ -1,6 +1,6 @@
 /* Process support for GNU Emacs on the Microsoft W32 API.
    Copyright (C) 1992, 1995, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-                2006, 2007, 2008  Free Software Foundation, Inc.
+                2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -29,6 +29,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <fcntl.h>
 #include <signal.h>
 #include <sys/file.h>
+#include <setjmp.h>
 
 /* must include CRT headers *before* config.h */
 
@@ -63,6 +64,7 @@ extern BOOL WINAPI IsValidLocale(LCID, DWORD);
 #include "syssignal.h"
 #include "w32term.h"
 #include "dispextern.h"                /* for xstrcasecmp */
+#include "coding.h"
 
 #define RVA_TO_PTR(var,section,filedata) \
   ((void *)((section)->PointerToRawData                                        \
@@ -702,7 +704,7 @@ w32_executable_type (char * filename, int * is_dos_app, int * is_cygnus_app, int
                 {
                   char * dllname = RVA_TO_PTR (imports->Name, section,
                                                executable);
-                  
+
                   /* The exact name of the cygwin dll has changed with
                      various releases, but hopefully this will be reasonably
                      future proof.  */
@@ -1781,7 +1783,7 @@ All path elements in FILENAME are converted to their short names.  */)
   filename = Fexpand_file_name (filename, Qnil);
 
   /* luckily, this returns the short version of each element in the path.  */
-  if (GetShortPathName (SDATA (filename), shortname, MAX_PATH) == 0)
+  if (GetShortPathName (SDATA (ENCODE_FILE (filename)), shortname, MAX_PATH) == 0)
     return Qnil;
 
   CORRECT_DIR_SEPS (shortname);
@@ -1799,18 +1801,29 @@ All path elements in FILENAME are converted to their long names.  */)
      Lisp_Object filename;
 {
   char longname[ MAX_PATH ];
+  int drive_only = 0;
 
   CHECK_STRING (filename);
 
+  if (SBYTES (filename) == 2
+      && *(SDATA (filename) + 1) == ':')
+    drive_only = 1;
+
   /* first expand it.  */
   filename = Fexpand_file_name (filename, Qnil);
 
-  if (!w32_get_long_filename (SDATA (filename), longname, MAX_PATH))
+  if (!w32_get_long_filename (SDATA (ENCODE_FILE (filename)), longname, MAX_PATH))
     return Qnil;
 
   CORRECT_DIR_SEPS (longname);
 
-  return build_string (longname);
+  /* If we were passed only a drive, make sure that a slash is not appended
+     for consistency with directories.  Allow for drive mapping via SUBST
+     in case expand-file-name is ever changed to expand those.  */
+  if (drive_only && longname[1] == ':' && longname[2] == '/' && !longname[3])
+    longname[2] = '\0';
+
+  return DECODE_FILE (build_string (longname));
 }
 
 DEFUN ("w32-set-process-priority", Fw32_set_process_priority,
@@ -1934,7 +1947,7 @@ DEFUN ("w32-get-locale-info", Fw32_get_locale_info,
        Sw32_get_locale_info, 1, 2, 0,
        doc: /* Return information about the Windows locale LCID.
 By default, return a three letter locale code which encodes the default
-language as the first two characters, and the country or regionial variant
+language as the first two characters, and the country or regional variant
 as the third letter.  For example, ENU refers to `English (United States)',
 while ENC means `English (Canadian)'.
 
@@ -1971,7 +1984,7 @@ If LCID (a 16-bit number) is not a valid locale, the result is nil.  */)
                                LOCALE_SLANGUAGE | LOCALE_USE_CP_ACP,
                                full_name, sizeof (full_name));
       if (got_full)
-       return build_string (full_name);
+       return DECODE_SYSTEM (build_string (full_name));
     }
   else if (NUMBERP (longform))
     {
@@ -2355,9 +2368,9 @@ the truename of a file can be slow.  */);
   DEFVAR_LISP ("w32-get-true-file-attributes", &Vw32_get_true_file_attributes,
               doc: /* Non-nil means determine accurate file attributes in `file-attributes'.
 This option controls whether to issue additional system calls to determine
-accurate link counts, file type, and ownership information.  It is only
+accurate link counts, file type, and ownership information.  It is more
 useful for files on NTFS volumes, where hard links and file security are
-supported.
+supported, than on volumes of the FAT family.
 
 Without these system calls, link count will always be reported as 1 and file
 ownership will be attributed to the current user.