aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2020-10-10 23:45:09 +0200
committerTeddy Wing2020-10-10 23:45:09 +0200
commite76001faf1c4439d0009ef1ab380d949316a2d86 (patch)
treef5bba83b0506ba5b4fdbbf93108d6fb0abafcbf8
parentc5e6ba6358d7d2e911bf6d056ba9617c5b8d75db (diff)
downloadDrop-Serve-e76001faf1c4439d0009ef1ab380d949316a2d86.tar.bz2
Open served URL in the default browser
-rw-r--r--Drop Serve/DropZone.m2
-rw-r--r--Drop Serve/Server.h2
-rw-r--r--Drop Serve/Server.m6
3 files changed, 10 insertions, 0 deletions
diff --git a/Drop Serve/DropZone.m b/Drop Serve/DropZone.m
index b01e1f2..52f6107 100644
--- a/Drop Serve/DropZone.m
+++ b/Drop Serve/DropZone.m
@@ -76,6 +76,8 @@
[_status_view setPath:path];
[_status_view setHidden:NO];
+
+ [Server openInBrowser];
}
return YES;
diff --git a/Drop Serve/Server.h b/Drop Serve/Server.h
index a19908f..44beaaf 100644
--- a/Drop Serve/Server.h
+++ b/Drop Serve/Server.h
@@ -15,4 +15,6 @@ NSTask *_process;
+ (void)serveAtPath:(NSString *)path;
+ (void)stop;
++ (void)openInBrowser;
+
@end
diff --git a/Drop Serve/Server.m b/Drop Serve/Server.m
index c584f3c..c0c69c3 100644
--- a/Drop Serve/Server.m
+++ b/Drop Serve/Server.m
@@ -30,4 +30,10 @@
[_process interrupt];
}
++ (void)openInBrowser
+{
+ [[NSWorkspace sharedWorkspace]
+ openURL:[NSURL URLWithString:@"http://localhost:8000"]];
+}
+
@end