mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-17 20:23:47 -04:00
search PLUGIN_IMAGES
This commit is contained in:
parent
2c3681ea07
commit
7d500fe372
@ -15,7 +15,7 @@ import glob
|
|||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
import direct
|
import direct
|
||||||
from pandac.PandaModules import Filename, DSearchPath, getModelPath
|
from pandac.PandaModules import Filename, DSearchPath, getModelPath, ExecutionEnvironment
|
||||||
|
|
||||||
def usage(code, msg = ''):
|
def usage(code, msg = ''):
|
||||||
print >> sys.stderr, __doc__
|
print >> sys.stderr, __doc__
|
||||||
@ -25,7 +25,7 @@ def usage(code, msg = ''):
|
|||||||
def makeBundle(startDir):
|
def makeBundle(startDir):
|
||||||
fstartDir = Filename.fromOsSpecific(startDir)
|
fstartDir = Filename.fromOsSpecific(startDir)
|
||||||
|
|
||||||
# Search for nppandad along $PATH.
|
# Search for panda3d_mac along $PATH.
|
||||||
path = DSearchPath()
|
path = DSearchPath()
|
||||||
if 'PATH' in os.environ:
|
if 'PATH' in os.environ:
|
||||||
path.appendPath(os.environ['PATH'])
|
path.appendPath(os.environ['PATH'])
|
||||||
@ -34,10 +34,24 @@ def makeBundle(startDir):
|
|||||||
if not panda3d_mac:
|
if not panda3d_mac:
|
||||||
raise StandardError, "Couldn't find panda3d_mac on path."
|
raise StandardError, "Couldn't find panda3d_mac on path."
|
||||||
|
|
||||||
# Find the icon file on the model-path.
|
# Construct a search path to look for the images.
|
||||||
icons = getModelPath().findFile('plugin_images/panda3d.icns')
|
search = DSearchPath()
|
||||||
if not icons:
|
|
||||||
icons = getModelPath().findFile('models/plugin_images/panda3d.icns')
|
# First on the path: an explicit $PLUGIN_IMAGES env var.
|
||||||
|
if ExecutionEnvironment.hasEnvironmentVariable('PLUGIN_IMAGES'):
|
||||||
|
search.appendDirectory(Filename.expandFrom('$PLUGIN_IMAGES'))
|
||||||
|
|
||||||
|
# Next on the path: the models/plugin_images directory within the
|
||||||
|
# current directory.
|
||||||
|
search.appendDirectory('models/plugin_images')
|
||||||
|
|
||||||
|
# Finally on the path: models/plugin_images within the model
|
||||||
|
# search path.
|
||||||
|
for dir in getModelPath().getDirectories():
|
||||||
|
search.appendDirectory(Filename(dir, 'plugin_images'))
|
||||||
|
|
||||||
|
# Now find the icon file on the above search path.
|
||||||
|
icons = search.findFile('panda3d.icns')
|
||||||
if not icons:
|
if not icons:
|
||||||
raise StandardError, "Couldn't find panda3d.icns on model-path."
|
raise StandardError, "Couldn't find panda3d.icns on model-path."
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user