inkstitch/lib/utils/paths.py

29 wiersze
945 B
Python
Czysty Zwykły widok Historia

2021-03-12 04:17:19 +00:00
# Authors: see git history
#
# Copyright (c) 2010 Authors
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
2018-07-05 01:16:49 +00:00
import sys
import os
from os.path import dirname, realpath
def get_bundled_dir(name):
if getattr(sys, 'frozen', None) is not None:
if sys.platform == "darwin":
return realpath(os.path.join(sys._MEIPASS, "..", 'Resources', name))
else:
return realpath(os.path.join(sys._MEIPASS, "..", name))
2018-07-05 01:16:49 +00:00
else:
return realpath(os.path.join(dirname(realpath(__file__)), '..', '..', name))
2018-09-09 04:06:47 +00:00
2018-09-13 00:25:15 +00:00
2018-09-09 04:06:47 +00:00
def get_resource_dir(name):
if getattr(sys, 'frozen', None) is not None:
if sys.platform == "darwin":
return realpath(os.path.join(sys._MEIPASS, "..", 'Resources', name))
else:
return realpath(os.path.join(sys._MEIPASS, name))
2018-09-09 04:06:47 +00:00
else:
return realpath(os.path.join(dirname(realpath(__file__)), '..', '..', name))