changeset 59576:bf1c907c5570

* macfns.c (Fx_file_dialog): Save As dialog includes only the file name in the text box.
author Steven Tamm <steventamm@mac.com>
date Sun, 16 Jan 2005 00:17:25 +0000
parents 011a0c55c1f2
children a4a748516aa7
files src/ChangeLog src/macfns.c
diffstat 2 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Jan 16 00:10:18 2005 +0000
+++ b/src/ChangeLog	Sun Jan 16 00:17:25 2005 +0000
@@ -1,3 +1,8 @@
+2005-01-15  Steven Tamm  <steventamm@mac.com>
+
+	* macfns.c (Fx_file_dialog): Save As dialog includes only the
+	file name in the text box.
+
 2005-01-15  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
 	* macfns.c (x_set_foreground_color, x_set_background_color): Sync
--- a/src/macfns.c	Sun Jan 16 00:10:18 2005 +0000
+++ b/src/macfns.c	Sun Jan 16 00:17:25 2005 +0000
@@ -4356,9 +4356,12 @@
 
 	if (!NILP(default_filename))
 	  {
-	    saveName =
-	      cfstring_create_with_utf8_cstring (SDATA (ENCODE_UTF_8
-							(default_filename)));
+	    Lisp_Object utf8 = ENCODE_UTF_8 (default_filename);
+	    char *begPtr = SDATA(utf8);
+	    char *filePtr = begPtr + SBYTES(utf8);
+	    while (filePtr != begPtr && !IS_DIRECTORY_SEP(filePtr[-1]))
+	      filePtr--;
+	    saveName = cfstring_create_with_utf8_cstring (filePtr);
 	    options.saveFileName = saveName;
 	    options.optionFlags |= kNavSelectDefaultLocation;
 	  }