mirror of
https://github.com/quantum5/punyverse.git
synced 2025-04-24 13:11:57 -04:00
Made cython model loader py2exe friendly.
This commit is contained in:
parent
e79321c8a9
commit
2746338e22
File diff suppressed because it is too large
Load diff
|
@ -257,8 +257,16 @@ cdef class WavefrontObject(object):
|
||||||
free(buf)
|
free(buf)
|
||||||
fclose(cfile)
|
fclose(cfile)
|
||||||
|
|
||||||
|
import sys
|
||||||
|
if hasattr(sys, 'frozen'):
|
||||||
|
model_base = os.path.dirname(sys.executable)
|
||||||
|
else:
|
||||||
|
model_base = os.path.join(os.path.dirname(__file__), 'assets', 'models')
|
||||||
|
del sys
|
||||||
|
|
||||||
def load_model(path):
|
def load_model(path):
|
||||||
path = os.path.join(os.path.dirname(__file__), 'assets', 'models', path)
|
if not os.path.isabs(path):
|
||||||
|
path = os.path.join(model_base, path)
|
||||||
if not isinstance(path, unicode):
|
if not isinstance(path, unicode):
|
||||||
path = path.decode('mbcs')
|
path = path.decode('mbcs')
|
||||||
return WavefrontObject(path)
|
return WavefrontObject(path)
|
||||||
|
|
Loading…
Reference in a new issue