mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-25 06:06:21 +03:00
Refactor slightly
This commit is contained in:
parent
0138899e40
commit
d51522ed3a
@ -16,22 +16,20 @@ extension NeoVimView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override public func performDragOperation(_ sender: NSDraggingInfo) -> Bool {
|
override public func performDragOperation(_ sender: NSDraggingInfo) -> Bool {
|
||||||
if !isFile(sender: sender) {
|
guard isFile(sender: sender) else {
|
||||||
return false;
|
return false
|
||||||
}
|
|
||||||
let paths = sender
|
|
||||||
.draggingPasteboard()
|
|
||||||
.propertyList(forType: NSFilenamesPboardType)
|
|
||||||
as? [String]
|
|
||||||
let urls = paths?
|
|
||||||
.map { URL(fileURLWithPath: $0) }
|
|
||||||
?? []
|
|
||||||
self.open(urls: urls)
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guard let paths = sender.draggingPasteboard().propertyList(forType: NSFilenamesPboardType) as? [String] else {
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func isFile(sender: NSDraggingInfo?) -> Bool {
|
self.open(urls: paths.map { URL(fileURLWithPath: $0) })
|
||||||
return (sender?.draggingPasteboard().types?.contains(String(kUTTypeFileURL))) ?? false
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fileprivate func isFile(sender: NSDraggingInfo) -> Bool {
|
||||||
|
return (sender.draggingPasteboard().types?.contains(String(kUTTypeFileURL))) ?? false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user