From 05d13de76671992475dc788701e7026b88c94dbc Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 7 Jul 2016 11:58:06 +1000 Subject: [PATCH] fix up ankiweb.certs paths also fixes https://anki.tenderapp.com/discussions/ankidesktop/18420-portable-anki-sync-error --- anki/sync.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/anki/sync.py b/anki/sync.py index 843f4e12e..3691edfd6 100644 --- a/anki/sync.py +++ b/anki/sync.py @@ -39,16 +39,15 @@ except AttributeError: def httpCon(): certs = os.path.join(os.path.dirname(__file__), "ankiweb.certs") if not os.path.exists(certs): - if isWin: - certs = os.path.join( - os.path.dirname(os.path.abspath(sys.argv[0])), - "ankiweb.certs") - elif isMac: - certs = os.path.join( - os.path.dirname(os.path.abspath(sys.argv[0])), - "../Resources/ankiweb.certs") + if not isMac: + certs = os.path.abspath(os.path.join( + os.path.dirname(certs), "..", "ankiweb.certs")) 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( timeout=HTTP_TIMEOUT, ca_certs=certs, proxy_info=HTTP_PROXY,