aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2008-02-20 12:06:52 +0000
committerJuanma Barranquero2008-02-20 12:06:52 +0000
commit50f271cb5a8a9cc415efb465023724d3d73937c8 (patch)
treef64ec154e646068a1e67e5f8ce4b6fb0502e3545
parent6f3003230d458207cc4f44abcd190df68239fb30 (diff)
downloademacs-50f271cb5a8a9cc415efb465023724d3d73937c8.tar.gz
emacs-50f271cb5a8a9cc415efb465023724d3d73937c8.zip
(main) [WINDOWSNT]: Understand DRIVE:NAME, where
NAME is relative to DRIVE'S current directory.
-rw-r--r--lib-src/ChangeLog5
-rw-r--r--lib-src/emacsclient.c58
2 files changed, 29 insertions, 34 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 1fee2324f54..3ce9155764a 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,8 @@
12008-02-20 Juanma Barranquero <lekktu@gmail.com>
2
3 * emacsclient.c (main) [WINDOWSNT]: Understand DRIVE:NAME,
4 where NAME is relative to DRIVE'S current directory.
5
12008-02-15 Juanma Barranquero <lekktu@gmail.com> 62008-02-15 Juanma Barranquero <lekktu@gmail.com>
2 7
3 * emacsclient.c (print_help_and_exit): Show -d option on Windows. 8 * emacsclient.c (print_help_and_exit): Show -d option on Windows.
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 7c537eb8c4e..1ccd8356ad2 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -848,38 +848,6 @@ file_name_absolute_p (filename)
848 848
849 /* Both \xxx and \\xxx\yyy are absolute. */ 849 /* Both \xxx and \\xxx\yyy are absolute. */
850 if (filename[0] == '\\') return TRUE; 850 if (filename[0] == '\\') return TRUE;
851
852 /*
853 FIXME: There's a corner case not dealt with, "x:y", where:
854
855 1) x is a valid drive designation (usually a letter in the A-Z range)
856 and y is a path, relative to the current directory on drive x. This
857 is absolute, *after* fixing the y part to include the current
858 directory in x.
859
860 2) x is a relative file name, and y is an NTFS stream name. This is a
861 correct relative path, but it is very unusual.
862
863 The trouble is that first case items are also valid examples of the
864 second case, i.e., "c:test" can be understood as drive:path or as
865 file:stream.
866
867 The "right" fix would involve checking whether
868 - the current drive/partition is NTFS,
869 - x is a valid (and accesible) drive designator,
870 - x:y already exists as a file:stream in the current directory,
871 - y already exists on the current directory of drive x,
872 - the auspices are favorable,
873 and then taking an "informed decision" based on the above.
874
875 Whatever the result, Emacs currently does a very bad job of dealing
876 with NTFS file:streams: it cannot visit them, and the only way to
877 create one is by setting `buffer-file-name' to point to it (either
878 manually or with emacsclient). So perhaps resorting to 1) and ignoring
879 2) for now is the right thing to do.
880
881 Anyway, something to decide After the Release.
882 */
883#endif 851#endif
884 852
885 return FALSE; 853 return FALSE;
@@ -1535,8 +1503,30 @@ main (argc, argv)
1535 else 1503 else
1536 relative = 1; 1504 relative = 1;
1537 } 1505 }
1538 else if (! file_name_absolute_p (argv[i])) 1506 else if (! file_name_absolute_p (argv[i]))
1539 relative = 1; 1507#ifndef WINDOWSNT
1508 relative = 1;
1509#else
1510 /* Call GetFullPathName so filenames of the form X:Y, where X is
1511 a valid drive designator, are interpreted as drive:path, not
1512 file:stream, and treated as absolute.
1513 The user can still pass a file:stream if desired (for example,
1514 .\X:Y, but it is not very useful, as Emacs currently does a
1515 very bad job of dealing wih NTFS streams. */
1516 {
1517 char *filename = (char *) xmalloc (MAX_PATH);
1518 DWORD size;
1519
1520 size = GetFullPathName (argv[i], MAX_PATH, filename, NULL);
1521 if (size > 0 && size < MAX_PATH)
1522 argv[i] = filename;
1523 else
1524 {
1525 relative = 1;
1526 free (filename);
1527 }
1528 }
1529#endif
1540 1530
1541 send_to_emacs (emacs_socket, "-file "); 1531 send_to_emacs (emacs_socket, "-file ");
1542 if (relative) 1532 if (relative)