summaryrefslogtreecommitdiff
path: root/src/nsfns.m
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-05-04 15:31:32 +0800
committerPo Lu <luangruo@yahoo.com>2022-05-04 15:31:32 +0800
commit4c9a7010bc553abb07ccc3c998faff9cf4472ed1 (patch)
treee3e3dbc518ceb76c676b3238fdf3f480a794e237 /src/nsfns.m
parent273b0b95c2e21c0d2e306b497b805e07d64fc5bc (diff)
downloademacs-4c9a7010bc553abb07ccc3c998faff9cf4472ed1.tar.gz
Correctly encode and decode filenames on NS
* src/nsfns.m (Fns_read_file_name): Run dir through ENCODE_FILE and fname through DECODE_FILE.
Diffstat (limited to 'src/nsfns.m')
-rw-r--r--src/nsfns.m30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/nsfns.m b/src/nsfns.m
index 41fea6f0fe6..a67dafe0950 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1677,16 +1677,18 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
BOOL isSave = NILP (mustmatch) && NILP (dir_only_p);
id panel;
Lisp_Object fname = Qnil;
-
- NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil :
- [NSString stringWithLispString:prompt];
- NSString *dirS = NILP (dir) || !STRINGP (dir) ?
- [NSString stringWithLispString:BVAR (current_buffer, directory)] :
- [NSString stringWithLispString:dir];
- NSString *initS = NILP (init) || !STRINGP (init) ? nil :
- [NSString stringWithLispString:init];
+ NSString *promptS, *dirS, *initS, *str;
NSEvent *nxev;
+ promptS = (NILP (prompt) || !STRINGP (prompt)
+ ? nil : [NSString stringWithLispString: prompt]);
+ dirS = (NILP (dir) || !STRINGP (dir)
+ ? [NSString stringWithLispString:
+ ENCODE_FILE (BVAR (current_buffer, directory))] :
+ [NSString stringWithLispString: ENCODE_FILE (dir)]);
+ initS = (NILP (init) || !STRINGP (init)
+ ? nil : [NSString stringWithLispString: init]);
+
check_window_system (NULL);
if (fileDelegate == nil)
@@ -1758,9 +1760,15 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
if (ns_fd_data.ret == MODAL_OK_RESPONSE)
{
- NSString *str = ns_filename_from_panel (panel);
- if (! str) str = ns_directory_from_panel (panel);
- if (str) fname = [str lispString];
+ str = ns_filename_from_panel (panel);
+
+ if (!str)
+ str = ns_directory_from_panel (panel);
+ if (str)
+ fname = [str lispString];
+
+ if (!NILP (fname))
+ fname = DECODE_FILE (fname);
}
[[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];