aboutsummaryrefslogtreecommitdiffstats
path: root/Drop Serve
diff options
context:
space:
mode:
authorTeddy Wing2020-10-10 20:10:39 +0200
committerTeddy Wing2020-10-10 20:10:39 +0200
commit4c390aa17fe8b431cbb0c3b65da3e22d8701f8d2 (patch)
tree2aca230e1c097823623713ad2717443315e45f13 /Drop Serve
parent0fd6d98d8fd069119e615f7be78b13e1b2b4f41f (diff)
downloadDrop-Serve-4c390aa17fe8b431cbb0c3b65da3e22d8701f8d2.tar.bz2
DropZone.m: If dropped file is not a directory, get dirname of file
Diffstat (limited to 'Drop Serve')
-rw-r--r--Drop Serve/DropZone.m17
1 files changed, 12 insertions, 5 deletions
diff --git a/Drop Serve/DropZone.m b/Drop Serve/DropZone.m
index ac7ccd0..6ae6e49 100644
--- a/Drop Serve/DropZone.m
+++ b/Drop Serve/DropZone.m
@@ -53,12 +53,19 @@
NSString *file = [files objectAtIndex:0];
BOOL isDirectory = false;
- if ([[NSFileManager defaultManager]
- fileExistsAtPath:file
- isDirectory:&isDirectory]
- && isDirectory) {
- NSLog(@"%@", file);
+ if (![[NSFileManager defaultManager]
+ fileExistsAtPath:file
+ isDirectory:&isDirectory]) {
+ NSLog(@"%@ not found", file);
}
+
+ NSURL *path = [NSURL fileURLWithPath:file isDirectory:isDirectory];
+
+ if (!isDirectory) {
+ path = [path URLByDeletingLastPathComponent];
+ }
+
+ NSLog(@"%@", path);
}
return YES;