diff options
| author | Teddy Wing | 2020-10-10 20:36:58 +0200 |
|---|---|---|
| committer | Teddy Wing | 2020-10-10 20:36:58 +0200 |
| commit | 06118327277b6488a62d48f1471366565be0109f (patch) | |
| tree | 405cadb6196a1563622864fd7c236f45167717a8 /Drop Serve/DropZone.m | |
| parent | d25f3e58ec4591ec884b43c6ac215699925ea726 (diff) | |
| download | Drop-Serve-06118327277b6488a62d48f1471366565be0109f.tar.bz2 | |
Start a Python SimpleHTTPServer in dropped file directory
When a file or directory is dropped on the drop zone, start a Python
SimpleHTTPServer from that directory.
Ensure the server is terminated when the Drop Serve application quits.
Diffstat (limited to 'Drop Serve/DropZone.m')
| -rw-r--r-- | Drop Serve/DropZone.m | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Drop Serve/DropZone.m b/Drop Serve/DropZone.m index 79c1fe6..56efb08 100644 --- a/Drop Serve/DropZone.m +++ b/Drop Serve/DropZone.m @@ -7,6 +7,7 @@ // #import "DropZone.h" +#import "Server.h" @implementation DropZone @@ -61,13 +62,15 @@ return NO; } - NSURL *path = [NSURL fileURLWithPath:file isDirectory:isDirectory]; + NSURL *url = [NSURL fileURLWithPath:file isDirectory:isDirectory]; if (!isDirectory) { - path = [path URLByDeletingLastPathComponent]; + url = [url URLByDeletingLastPathComponent]; } - NSLog(@"%@", path); + NSLog(@"%@", url); + + [Server serveAtPath:[url path]]; } return YES; |
