summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvery Pennarun <apenwarr@gmail.com>2011-01-22 16:35:31 -0800
committerAvery Pennarun <apenwarr@gmail.com>2011-01-22 16:44:20 -0800
commitd4ccd30c24b717113f1e94c440c0b60cff14f63d (patch)
tree3a582615d9aa056892d1fa2ad516e1bceccdfbf2
parent522bc23854b8b3cd985a7d856c58f4a9b811ad16 (diff)
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.
-rw-r--r--ui-macos/Info.plist2
-rwxr-xr-xui-macos/bits/run3
-rw-r--r--ui-macos/bits/runpython.c13
-rw-r--r--ui-macos/debug.app.do2
-rw-r--r--ui-macos/default.app.do4
5 files changed, 15 insertions, 9 deletions
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 @@
<key>CFBundleDisplayName</key>
<string>Sshuttle VPN</string>
<key>CFBundleExecutable</key>
- <string>run</string>
+ <string>Sshuttle</string>
<key>CFBundleIconFile</key>
<string>app.icns</string>
<key>CFBundleIdentifier</key>
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 <Python.h>
+#include <string.h>
+#include <unistd.h>
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 <sources.list)
rm -rf "$1.app"
@@ -10,7 +10,7 @@ cd "$1.app/Contents"
cp "$TOP/Info.plist" .
mkdir MacOS
-cp "$TOP/bits/runpython" "$TOP/bits/run" MacOS/
+cp "$TOP/bits/runpython" MacOS/Sshuttle
mkdir Resources