[Pkg-anonymity-tools] [onionshare] 51/57: changed cwd in onionshare CLI script for OSX in the right places to support both loading strings and relative paths for files to share (#132)
Ulrike Uhlig
u-guest at moszumanska.debian.org
Tue May 19 18:18:58 UTC 2015
This is an automated email from the git hooks/post-receive script.
u-guest pushed a commit to annotated tag 0.7
in repository onionshare.
commit 815c2a8741dfaaaa46a87ca4715fa83f3cd3f7aa
Author: Micah Lee <micah at micahflee.com>
Date: Sat May 16 13:37:28 2015 -0700
changed cwd in onionshare CLI script for OSX in the right places to support both loading strings and relative paths for files to share (#132)
---
install/osx_scripts/onionshare | 10 +++++++---
onionshare/onionshare.py | 8 +++++++-
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/install/osx_scripts/onionshare b/install/osx_scripts/onionshare
index 7253b06..f2cdb40 100755
--- a/install/osx_scripts/onionshare
+++ b/install/osx_scripts/onionshare
@@ -19,8 +19,12 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import zipimport, os, inspect
-cwd = os.path.dirname(os.path.realpath(os.path.abspath(inspect.getfile(inspect.currentframe()))))
-os.chdir(cwd)
+
+original_cwd = os.getcwd()
+new_cwd = os.path.dirname(os.path.realpath(os.path.abspath(inspect.getfile(inspect.currentframe()))))
+os.chdir(new_cwd)
+
zi = zipimport.zipimporter('lib/python2.7/site-packages.zip')
onionshare = zi.load_module('onionshare')
-onionshare.main()
+
+onionshare.main(original_cwd)
diff --git a/onionshare/onionshare.py b/onionshare/onionshare.py
index e3df8ed..2e948c7 100644
--- a/onionshare/onionshare.py
+++ b/onionshare/onionshare.py
@@ -253,8 +253,14 @@ def tails_root():
time.sleep(1)
-def main():
+def main(cwd=None):
strings.load_strings()
+
+ # onionshare CLI in OSX needs to change current working directory (#132)
+ if helpers.get_platform() == 'Darwin':
+ if cwd:
+ os.chdir(cwd)
+
tails_root()
# parse arguments
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/onionshare.git
More information about the Pkg-anonymity-tools
mailing list