summaryrefslogtreecommitdiff
path: root/src/nsselect.m
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-06-04 16:19:01 +0800
committerPo Lu <luangruo@yahoo.com>2022-06-04 16:19:01 +0800
commiteffbd2aeef3d6ec3d09d40ff095e072b2d9834d4 (patch)
treec1e9b43ffd0477923fc695e519833fd1748ba9b0 /src/nsselect.m
parent2ce686c049a7a35cdc3eb87626d8a94539388a35 (diff)
downloademacs-effbd2aeef3d6ec3d09d40ff095e072b2d9834d4.tar.gz
Fix file drag-and-drop on GNUstep
* src/nsselect.m (ns_decode_data_to_pasteboard): Convert URL to path names when we're using NSFilenamesPboardType. * src/nsterm.m: ([EmacsView performDragOperation:]): Handle cases where plist is a string.
Diffstat (limited to 'src/nsselect.m')
-rw-r--r--src/nsselect.m10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/nsselect.m b/src/nsselect.m
index a719eef4e86..6831090aa20 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -565,6 +565,9 @@ ns_decode_data_to_pasteboard (Lisp_Object type, Lisp_Object data,
NSMutableArray *temp;
Lisp_Object tem;
specpdl_ref count;
+#if !NS_USE_NSPasteboardTypeFileURL
+ NSURL *url;
+#endif
types = [pasteboard types];
count = SPECPDL_INDEX ();
@@ -602,7 +605,12 @@ ns_decode_data_to_pasteboard (Lisp_Object type, Lisp_Object data,
[pasteboard setString: [NSString stringWithLispString: data]
forType: NSPasteboardTypeFileURL];
#else
- [pasteboard setString: [NSString stringWithLispString: data]
+ url = [NSURL URLWithString: [NSString stringWithLispString: data]];
+
+ if (!url)
+ signal_error ("Invalid file URL", data);
+
+ [pasteboard setString: [url path]
forType: NSFilenamesPboardType];
#endif
}