2 from __future__ import absolute_import
6 __all__ = ['getPathForResource', 'getPathForImage', 'getPathForMesh']
9 if sys.platform.startswith('darwin'):
10 if hasattr(sys, 'frozen'):
11 from Foundation import *
12 imagesPath = os.path.join(NSBundle.mainBundle().resourcePath(), 'images')
13 meshesPath = os.path.join(NSBundle.mainBundle().resourcePath(), 'images')
15 imagesPath = os.path.join(os.path.dirname(__file__), "../images")
16 meshesPath = os.path.join(os.path.dirname(__file__), "../images")
18 if hasattr(sys, 'frozen'):
19 imagesPath = os.path.join(os.path.dirname(__file__), "../../images")
20 meshesPath = os.path.join(os.path.dirname(__file__), "../../images")
22 imagesPath = os.path.join(os.path.dirname(__file__), "../images")
23 meshesPath = os.path.join(os.path.dirname(__file__), "../images")
26 def getPathForResource(dir, resource_name):
27 assert os.path.isdir(dir), "{p} is not a directory".format(p=dir)
28 path = os.path.normpath(os.path.join(dir, resource_name))
29 assert os.path.isfile(path), "{p} is not a file.".format(p=path)
32 def getPathForImage(name):
33 return getPathForResource(imagesPath, name)
35 def getPathForMesh(name):
36 return getPathForResource(meshesPath, name)