fix up ankiweb.certs paths

also fixes
https://anki.tenderapp.com/discussions/ankidesktop/18420-portable-anki-sync-error
This commit is contained in:
Damien Elmes 2016-07-07 11:58:06 +10:00
parent 39a2ddac51
commit 05d13de766

View file

@ -39,16 +39,15 @@ except AttributeError:
def httpCon(): def httpCon():
certs = os.path.join(os.path.dirname(__file__), "ankiweb.certs") certs = os.path.join(os.path.dirname(__file__), "ankiweb.certs")
if not os.path.exists(certs): if not os.path.exists(certs):
if isWin: if not isMac:
certs = os.path.join( certs = os.path.abspath(os.path.join(
os.path.dirname(os.path.abspath(sys.argv[0])), os.path.dirname(certs), "..", "ankiweb.certs"))
"ankiweb.certs")
elif isMac:
certs = os.path.join(
os.path.dirname(os.path.abspath(sys.argv[0])),
"../Resources/ankiweb.certs")
else: else:
assert 0, "Your distro has not packaged Anki correctly." certs = os.path.abspath(os.path.join(
os.path.dirname(os.path.abspath(sys.argv[0])),
"../Resources/ankiweb.certs"))
if not os.path.exists(certs):
assert 0, "Unable to locate ankiweb.certs"
return httplib2.Http( return httplib2.Http(
timeout=HTTP_TIMEOUT, ca_certs=certs, timeout=HTTP_TIMEOUT, ca_certs=certs,
proxy_info=HTTP_PROXY, proxy_info=HTTP_PROXY,