macos: paste multiple files separated by space

https://github.com/ghostty-org/ghostty/discussions/4892#discussioncomment-11808631
This commit is contained in:
Mitchell Hashimoto
2025-01-11 13:57:37 -08:00
parent 918ccdba5c
commit 0811b1d5ac

View File

@ -13,11 +13,11 @@ extension NSPasteboard {
/// - Tries to get any string from the pasteboard.
/// If all of the above fail, returns None.
func getOpinionatedStringContents() -> String? {
if let file = self.string(forType: .fileURL) {
if let path = NSURL(string: file)?.path {
return path
}
if let urls = readObjects(forClasses: [NSURL.self]) as? [URL],
urls.count > 0 {
return urls.map { $0.path }.joined(separator: " ")
}
return self.string(forType: .string)
}