diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index 05e5965788..ac79203e7b 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -27,8 +27,7 @@ from direct.showbase.BufferViewer import BufferViewer from direct.task import Task from direct.directutil import Verify import EventManager -import math -import sys +import math,sys,os import Loader import time from direct.fsm import ClassicFSM @@ -50,6 +49,12 @@ class ShowBase(DirectObject.DirectObject): notify = directNotify.newCategory("ShowBase") def __init__(self): + + # Locate the directory containing the main program + maindir=os.path.abspath(sys.path[0]) + self.mainDir = Filename.fromOsSpecific(maindir).getFullpath() + ExecutionEnvironment.setEnvironmentVariable("MAIN_DIR", self.mainDir) + # Get the dconfig object #self.config = ConfigConfigureGetConfigConfigShowbase self.config = config diff --git a/doc/makepanda/config.in b/doc/makepanda/config.in index 89f09c46c1..2d70859282 100755 --- a/doc/makepanda/config.in +++ b/doc/makepanda/config.in @@ -39,13 +39,13 @@ default-directnotify-level warning # a special variable that indicates the same directory as this # particular Config.prc file. -model-path . +model-path $MAIN_DIR model-path $THIS_PRC_DIR/.. model-path $THIS_PRC_DIR/../models -sound-path . +sound-path $MAIN_DIR sound-path $THIS_PRC_DIR/.. sound-path $THIS_PRC_DIR/../models -texture-path . +texture-path $MAIN_DIR texture-path $THIS_PRC_DIR/.. texture-path $THIS_PRC_DIR/../models