mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-14 12:29:02 +00:00
Get server resource independant of working directory
This commit is contained in:
parent
85c185604e
commit
ada94d486a
@ -55,7 +55,7 @@ class CrashReport:
|
||||
DSN = "sync+https://9e6f04df72c74b6894a6dcd2928d069e:2035d1beb1654136b170f1e91f05ee51@app.getsentry.com/38482"
|
||||
if hasattr(sys, "frozen"):
|
||||
cacert = get_resource("cacert.pem")
|
||||
if os.path.isfile(cacert):
|
||||
if cacert is not None and os.path.isfile(cacert):
|
||||
DSN += "?ca_certs={}".format(cacert)
|
||||
else:
|
||||
log.warning("The SSL certificate bundle file '{}' could not be found".format(cacert))
|
||||
|
@ -50,10 +50,10 @@ def get_resource(resource_name):
|
||||
|
||||
resource_path = None
|
||||
if hasattr(sys, "frozen") and sys.platform.startswith("darwin"):
|
||||
resource_name = os.path.join("../Resources", resource_name)
|
||||
resource_name = os.path.join(os.path.dirname(sys.executable), "../Resources", resource_name)
|
||||
if hasattr(sys, "frozen") and os.path.exists(resource_name):
|
||||
resource_path = os.path.normpath(os.path.join(os.getcwd(), resource_name))
|
||||
elif not hasattr(sys, "frozen") and pkg_resources.resource_exists("gns3", resource_name):
|
||||
resource_path = pkg_resources.resource_filename("gns3", resource_name)
|
||||
resource_path = os.path.normpath(os.path.join(os.path.dirname(sys.executable), resource_name))
|
||||
elif not hasattr(sys, "frozen") and pkg_resources.resource_exists("gns3server", resource_name):
|
||||
resource_path = pkg_resources.resource_filename("gns3server", resource_name)
|
||||
resource_path = os.path.normpath(resource_path)
|
||||
return resource_path
|
||||
|
Loading…
Reference in New Issue
Block a user