mirror of
https://github.com/onionshare/onionshare.git
synced 2025-12-17 09:14:14 -05:00
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)
This commit is contained in:
parent
a41109dcb4
commit
815c2a8741
2 changed files with 14 additions and 4 deletions
|
|
@ -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/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
import zipimport, os, inspect
|
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')
|
zi = zipimport.zipimporter('lib/python2.7/site-packages.zip')
|
||||||
onionshare = zi.load_module('onionshare')
|
onionshare = zi.load_module('onionshare')
|
||||||
onionshare.main()
|
|
||||||
|
onionshare.main(original_cwd)
|
||||||
|
|
|
||||||
|
|
@ -253,8 +253,14 @@ def tails_root():
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main(cwd=None):
|
||||||
strings.load_strings()
|
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()
|
tails_root()
|
||||||
|
|
||||||
# parse arguments
|
# parse arguments
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue