1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-03-11 04:42:20 +00:00

Add file/directory discriminator.

This commit is contained in:
Thomas Harte
2025-11-25 21:24:19 -05:00
parent af255a43f3
commit e98e7b8f91

View File

@@ -551,10 +551,13 @@ class MachinePicker: NSObject, NSTableViewDataSource, NSTableViewDelegate, NSPat
}
func pathControl(_ pathControl: NSPathControl, validateDrop info: any NSDraggingInfo) -> NSDragOperation {
// TODO: accept if the pasteboard contains NSURLPboardType or NSFilenamesPboardType,
// and if the referenced file is a directory.
return NSDragOperation.link
// Accept only directories.
if let url = NSURL(from: info.draggingPasteboard) {
if url.hasDirectoryPath {
return NSDragOperation.link
}
}
return []
}
func establishPathControl(_ pathControl: NSPathControl, userDefaultsKey: String) {