macos: paste multiple files separated by space (#4956)

https://github.com/ghostty-org/ghostty/discussions/4892#discussioncomment-11808631
This commit is contained in:
Mitchell Hashimoto
2025-01-11 14:10:57 -08:00
committed by GitHub

View File

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