Mitchell Hashimoto 2025-01-11 13:57:37 -08:00
parent 918ccdba5c
commit 0811b1d5ac
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
1 changed files with 4 additions and 4 deletions

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)
}