diff options
| author | Teddy Wing | 2020-10-10 19:45:58 +0200 |
|---|---|---|
| committer | Teddy Wing | 2020-10-10 19:45:58 +0200 |
| commit | 5e5f6a8e195218d63c2c302265c5c4ece995d77c (patch) | |
| tree | 3be0c649c4922efeea52c6fa0829a20a61e838db /Drop Serve | |
| parent | 660a772195dfc13168cf9c797802462eb98938c0 (diff) | |
| download | Drop-Serve-5e5f6a8e195218d63c2c302265c5c4ece995d77c.tar.bz2 | |
DropZone.m: Require a directory to be dragged
Diffstat (limited to 'Drop Serve')
| -rw-r--r-- | Drop Serve/DropZone.m | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Drop Serve/DropZone.m b/Drop Serve/DropZone.m index 185ac28..8eb156a 100644 --- a/Drop Serve/DropZone.m +++ b/Drop Serve/DropZone.m @@ -44,7 +44,18 @@ if ([[pboard types] containsObject:NSFilenamesPboardType]) { NSArray *files = [pboard propertyListForType:NSFilenamesPboardType]; - NSLog(@"%@", files); + for (int i = 0; i < [files count]; i++) { + NSString *file = [files objectAtIndex:i]; + BOOL isDirectory = false; + + if ([[NSFileManager defaultManager] + fileExistsAtPath:file + isDirectory:&isDirectory] + && isDirectory) { + NSLog(@"%@", file); + break; + } + } } return YES; |
