From d4ccd30c24b717113f1e94c440c0b60cff14f63d Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sat, 22 Jan 2011 16:35:31 -0800 Subject: ui-macos: call the main binary MacOS/Sshuttle. That way we can 'killall Sshuttle' and so on, and it looks right in the process list. --- ui-macos/Info.plist | 2 +- ui-macos/bits/run | 3 --- ui-macos/bits/runpython.c | 13 +++++++++++-- ui-macos/debug.app.do | 2 +- ui-macos/default.app.do | 4 ++-- 5 files changed, 15 insertions(+), 9 deletions(-) delete mode 100755 ui-macos/bits/run diff --git a/ui-macos/Info.plist b/ui-macos/Info.plist index 65c0486..b495531 100644 --- a/ui-macos/Info.plist +++ b/ui-macos/Info.plist @@ -7,7 +7,7 @@ CFBundleDisplayName Sshuttle VPN CFBundleExecutable - run + Sshuttle CFBundleIconFile app.icns CFBundleIdentifier diff --git a/ui-macos/bits/run b/ui-macos/bits/run deleted file mode 100755 index e63750f..0000000 --- a/ui-macos/bits/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -cd "$(dirname "$0")" -exec ./runpython ../Resources/main.py diff --git a/ui-macos/bits/runpython.c b/ui-macos/bits/runpython.c index 2d982f5..63de339 100644 --- a/ui-macos/bits/runpython.c +++ b/ui-macos/bits/runpython.c @@ -7,8 +7,17 @@ * goes wrong if your interpreter is /usr/bin/python. */ #include +#include +#include int main(int argc, char **argv) { - return Py_Main(argc, argv); -} \ No newline at end of file + char *path = strdup(argv[0]), *cptr; + char *args[] = {argv[0], "../Resources/main.py", NULL}; + cptr = strrchr(path, '/'); + if (cptr) + *cptr = 0; + chdir(path); + free(path); + return Py_Main(2, args); +} diff --git a/ui-macos/debug.app.do b/ui-macos/debug.app.do index 28bda45..77e2e7e 100644 --- a/ui-macos/debug.app.do +++ b/ui-macos/debug.app.do @@ -9,7 +9,7 @@ ln -s ../../app.icns . mkdir MacOS cd MacOS -ln -s ../../../bits/runpython ../../../bits/run . +ln -s ../../../bits/runpython Sshuttle cd ../../.. redo-ifchange $(find debug.app -type f) diff --git a/ui-macos/default.app.do b/ui-macos/default.app.do index 6acb47d..64e3a52 100644 --- a/ui-macos/default.app.do +++ b/ui-macos/default.app.do @@ -1,6 +1,6 @@ TOP=$PWD redo-ifchange sources.list -redo-ifchange Info.plist bits/runpython bits/run \ +redo-ifchange Info.plist bits/runpython \ $(while read name newname; do echo "$name"; done