emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115742: Fix bug #16252 with 'mailto:' documents pas


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r115742: Fix bug #16252 with 'mailto:' documents passed to w32-shell-execute.
Date: Wed, 25 Dec 2013 17:31:18 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115742
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/16252
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Wed 2013-12-25 19:30:24 +0200
message:
  Fix bug #16252 with 'mailto:' documents passed to w32-shell-execute.
  
   src/w32fns.c (Fw32_shell_execute): Make DOCUMENT absolute only if it
   is a file name.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/w32fns.c                   w32fns.c-20091113204419-o5vbwnq5f7feedwu-945
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-12-25 10:24:52 +0000
+++ b/src/ChangeLog     2013-12-25 17:30:24 +0000
@@ -1,3 +1,8 @@
+2013-12-25  Eli Zaretskii  <address@hidden>
+
+       * w32fns.c (Fw32_shell_execute): Make DOCUMENT absolute only if it
+       is a file name.  (Bug#16252)
+
 2013-12-25  Chong Yidong  <address@hidden>
 
        * keyboard.c (Voverriding_terminal_local_map):

=== modified file 'src/w32fns.c'
--- a/src/w32fns.c      2013-12-24 17:21:06 +0000
+++ b/src/w32fns.c      2013-12-25 17:30:24 +0000
@@ -6851,7 +6851,8 @@
 
 DOCUMENT is typically the name of a document file or a URL, but can
 also be a program executable to run, or a directory to open in the
-Windows Explorer.
+Windows Explorer.  If it is a file, it must be a local one; this
+function does not support remote file names.
 
 If DOCUMENT is a program executable, the optional third arg PARAMETERS
 can be a string containing command line parameters that will be passed
@@ -6875,6 +6876,7 @@
 #ifndef CYGWIN
   int use_unicode = w32_unicode_filenames;
   char *doc_a = NULL, *params_a = NULL, *ops_a = NULL;
+  Lisp_Object absdoc;
 #endif
 
   CHECK_STRING (document);
@@ -6903,7 +6905,16 @@
                                      ? XINT (show_flag) : SW_SHOWDEFAULT));
 #else  /* !CYGWIN */
   current_dir = ENCODE_FILE (current_dir);
-  document = ENCODE_FILE (Fexpand_file_name (document, Qnil));
+  /* We have a situation here.  If DOCUMENT is a relative file name,
+     and is not in CURRENT_DIR, ShellExecute below will fail to find
+     it.  So we need to make the file name absolute.  But DOCUMENT
+     does not have to be a file, it can be a URL, for example.  So we
+     make it absolute only if it is an existing file; if it is a file
+     that does not exist, tough.  */
+  absdoc = Fexpand_file_name (document, Qnil);
+  if (!NILP (Ffile_exists_p (absdoc)))
+    document = absdoc;
+  document = ENCODE_FILE (document);
   if (use_unicode)
     {
       wchar_t document_w[MAX_PATH], current_dir_w[MAX_PATH];


reply via email to

[Prev in Thread] Current Thread [Next in Thread]