Commit bd34a2d8 authored by David Fifield's avatar David Fifield
Browse files

On OS X, install a shim that sets the working directory.

This is to work around a change in OS X 10.9, where application bundles
launched by Finder have a working directory of "/". We find out where we
live by taking the basename of the shim script, and set that as the
current directory before launching the real tor executable.

Without having the current directory set, tor can't find its pluggable
transport executables.
parent 4948a669
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -165,6 +165,10 @@ $(PT_BUNDLE_MACOSX_I686):

	cat $(SRCDIR)/bundle-torrc-macosx >> "$(tbbdir)"/Library/Vidalia/torrc

	# Install a "tor" shim that sets the working directory. See #10030.
	mv "$(tbbdir)"/Contents/MacOS/tor "$(tbbdir)"/Contents/MacOS/tor.real
	cp $(SRCDIR)/macosx-tor.sh "$(tbbdir)"/Contents/MacOS/tor

	cd "$(workdir)" && zip -r -9 "$@" TorBrowser_en-US.app/
	mv "$(workdir)/$@" .

macosx-tor.sh

0 → 100755
+8 −0
Original line number Diff line number Diff line
#!/bin/sh
# Set the current working directory to the directory containing this executable,
# so that pluggable transport executables can be given with relative paths. This
# works around a change in OS X 10.9, where the current working directory is
# otherwise set to "/" when an application bundle is started from Finder.
# https://trac.torproject.org/projects/tor/ticket/10030
cd "$(dirname "$0")"
exec ./tor.real "$@"