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.
This commit is contained in:
Avery Pennarun 2011-01-22 16:35:31 -08:00
parent 522bc23854
commit d4ccd30c24
5 changed files with 15 additions and 9 deletions

View File

@ -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>

View File

@ -1,3 +0,0 @@
#!/bin/sh
cd "$(dirname "$0")"
exec ./runpython ../Resources/main.py

View File

@ -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);
}
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);
}

View File

@ -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)

View File

@ -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