mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-10 19:52:50 -03:00
Fixed IOError in onionshare.py (load_strings())
Onionshare.py can now be run from inside ~/onionshare/onionshare.
This commit is contained in:
parent
5475038d79
commit
7545965edb
1 changed files with 5 additions and 2 deletions
|
@ -2,6 +2,7 @@ import os, sys, subprocess, time, hashlib, platform, json, locale, socket, argpa
|
||||||
from random import randint
|
from random import randint
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
|
|
||||||
def get_platform():
|
def get_platform():
|
||||||
if 'ONIONSHARE_PLATFORM' in os.environ:
|
if 'ONIONSHARE_PLATFORM' in os.environ:
|
||||||
return os.environ['ONIONSHARE_PLATFORM']
|
return os.environ['ONIONSHARE_PLATFORM']
|
||||||
|
@ -96,8 +97,10 @@ def tails_close_port(port):
|
||||||
|
|
||||||
def load_strings(default="en"):
|
def load_strings(default="en"):
|
||||||
global strings
|
global strings
|
||||||
translated = json.loads(open('{0}/strings.json'.format(
|
try:
|
||||||
os.path.dirname(__file__))).read())
|
translated = json.loads(open('{0}/strings.json'.format(os.getcwd())).read())
|
||||||
|
except IOError:
|
||||||
|
translated = json.loads(open('{0}/strings.json'.format(os.path.dirname(__file__))).read())
|
||||||
strings = translated[default]
|
strings = translated[default]
|
||||||
lc, enc = locale.getdefaultlocale()
|
lc, enc = locale.getdefaultlocale()
|
||||||
if lc:
|
if lc:
|
||||||
|
|
Loading…
Reference in a new issue