aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2022-05-04 15:31:32 +0800
committerPo Lu2022-05-04 15:31:32 +0800
commit4c9a7010bc553abb07ccc3c998faff9cf4472ed1 (patch)
treee3e3dbc518ceb76c676b3238fdf3f480a794e237
parent273b0b95c2e21c0d2e306b497b805e07d64fc5bc (diff)
downloademacs-4c9a7010bc553abb07ccc3c998faff9cf4472ed1.tar.gz
emacs-4c9a7010bc553abb07ccc3c998faff9cf4472ed1.zip
Correctly encode and decode filenames on NS
* src/nsfns.m (Fns_read_file_name): Run dir through ENCODE_FILE and fname through DECODE_FILE.
-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. */)
1677 BOOL isSave = NILP (mustmatch) && NILP (dir_only_p); 1677 BOOL isSave = NILP (mustmatch) && NILP (dir_only_p);
1678 id panel; 1678 id panel;
1679 Lisp_Object fname = Qnil; 1679 Lisp_Object fname = Qnil;
1680 1680 NSString *promptS, *dirS, *initS, *str;
1681 NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil :
1682 [NSString stringWithLispString:prompt];
1683 NSString *dirS = NILP (dir) || !STRINGP (dir) ?
1684 [NSString stringWithLispString:BVAR (current_buffer, directory)] :
1685 [NSString stringWithLispString:dir];
1686 NSString *initS = NILP (init) || !STRINGP (init) ? nil :
1687 [NSString stringWithLispString:init];
1688 NSEvent *nxev; 1681 NSEvent *nxev;
1689 1682
1683 promptS = (NILP (prompt) || !STRINGP (prompt)
1684 ? nil : [NSString stringWithLispString: prompt]);
1685 dirS = (NILP (dir) || !STRINGP (dir)
1686 ? [NSString stringWithLispString:
1687 ENCODE_FILE (BVAR (current_buffer, directory))] :
1688 [NSString stringWithLispString: ENCODE_FILE (dir)]);
1689 initS = (NILP (init) || !STRINGP (init)
1690 ? nil : [NSString stringWithLispString: init]);
1691
1690 check_window_system (NULL); 1692 check_window_system (NULL);
1691 1693
1692 if (fileDelegate == nil) 1694 if (fileDelegate == nil)
@@ -1758,9 +1760,15 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
1758 1760
1759 if (ns_fd_data.ret == MODAL_OK_RESPONSE) 1761 if (ns_fd_data.ret == MODAL_OK_RESPONSE)
1760 { 1762 {
1761 NSString *str = ns_filename_from_panel (panel); 1763 str = ns_filename_from_panel (panel);
1762 if (! str) str = ns_directory_from_panel (panel); 1764
1763 if (str) fname = [str lispString]; 1765 if (!str)
1766 str = ns_directory_from_panel (panel);
1767 if (str)
1768 fname = [str lispString];
1769
1770 if (!NILP (fname))
1771 fname = DECODE_FILE (fname);
1764 } 1772 }
1765 1773
1766 [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow]; 1774 [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];