Browse Source

A few more tweaks to support no-hardcoded-paths

Josh Yelon 21 years ago
parent
commit
33c2803608

+ 2 - 1
direct/src/ffi/FFIInterrogateDatabase.py

@@ -725,7 +725,8 @@ class FFIInterrogateDatabase:
         # before we begin.
         # before we begin.
         for file in os.listdir(codeDir):
         for file in os.listdir(codeDir):
             pathname = os.path.join(codeDir, file)
             pathname = os.path.join(codeDir, file)
-            os.unlink(pathname)
+            if not os.path.isdir(pathname):
+                os.unlink(pathname)
         
         
         # Import all the C++ modules
         # Import all the C++ modules
         for CModuleName in FFIConstants.CodeModuleNameList:
         for CModuleName in FFIConstants.CodeModuleNameList:

+ 2 - 2
direct/src/ffi/jGenPyCode.py

@@ -26,10 +26,10 @@ DIRECT=None
 PANDAC=None
 PANDAC=None
 for dir in sys.path:
 for dir in sys.path:
     if (DIRECT is None):
     if (DIRECT is None):
-        if os.path.exist(os.path.join(dir,"direct")):
+        if os.path.exists(os.path.join(dir,"direct")):
             DIRECT=os.path.join(dir,"direct")
             DIRECT=os.path.join(dir,"direct")
     if (PANDAC is None):
     if (PANDAC is None):
-        if (os.path.exist(os.path.join(dir,"pandac"))):
+        if (os.path.exists(os.path.join(dir,"pandac"))):
             PANDAC=os.path.join(dir,"pandac")
             PANDAC=os.path.join(dir,"pandac")
 
 
 if (DIRECT is None):
 if (DIRECT is None):

+ 2 - 2
doc/doc/Config.prc

@@ -44,9 +44,9 @@ framebuffer-mode rgba double-buffer depth multisample hardware software
 # a special variable that indicates the same directory as this
 # a special variable that indicates the same directory as this
 # particular Config.prc file.
 # particular Config.prc file.
 model-path  .
 model-path  .
-model-path  $THIS_PRC_DIR
+model-path  $THIS_PRC_DIR/..
 sound-path  .
 sound-path  .
-sound-path  $THIS_PRC_DIR
+sound-path  $THIS_PRC_DIR/..
 
 
 # This makes the egg loader available to load egg files.
 # This makes the egg loader available to load egg files.
 load-file-type pandaegg
 load-file-type pandaegg

+ 1 - 1
doc/makepanda/makepanda.py

@@ -247,7 +247,7 @@ DTOOLDEFAULTS=[
     ("LINK_IN_GL",                     'UNDEF',                  'UNDEF'),
     ("LINK_IN_GL",                     'UNDEF',                  'UNDEF'),
     ("LINK_IN_PHYSICS",                'UNDEF',                  'UNDEF'),
     ("LINK_IN_PHYSICS",                'UNDEF',                  'UNDEF'),
     ("DEFAULT_PATHSEP",                '";"',                    '":"'),
     ("DEFAULT_PATHSEP",                '";"',                    '":"'),
-    ("DEFAULT_PRC_DIR",                '"<auto>/etc"',           '"<auto>/etc"'),
+    ("DEFAULT_PRC_DIR",                '"<auto>etc"',            '"<auto>etc"'),
     ("PRC_DIR_ENVVARS",                '"PANDA_PRC_DIR"',        '"PANDA_PRC_DIR"'),
     ("PRC_DIR_ENVVARS",                '"PANDA_PRC_DIR"',        '"PANDA_PRC_DIR"'),
     ("PRC_PATH_ENVVARS",               '"PANDA_PRC_PATH"',       '"PANDA_PRC_PATH"'),
     ("PRC_PATH_ENVVARS",               '"PANDA_PRC_PATH"',       '"PANDA_PRC_PATH"'),
     ("PRC_PATTERNS",                   '"*.prc"',                '"*.prc"'),
     ("PRC_PATTERNS",                   '"*.prc"',                '"*.prc"'),

+ 24 - 22
dtool/src/prc/configPageManager.cxx

@@ -452,7 +452,7 @@ scan_auto_prc_dir(Filename &prc_dir) const {
   if (prc_dir_string.substr(0, 6) == "<auto>") {
   if (prc_dir_string.substr(0, 6) == "<auto>") {
     Filename suffix = prc_dir_string.substr(6);
     Filename suffix = prc_dir_string.substr(6);
     
     
-    // Start at the executable directory.
+    // Start at the dtool directory.
     Filename dtool = ExecutionEnvironment::get_dtool_name();
     Filename dtool = ExecutionEnvironment::get_dtool_name();
     Filename dir = dtool.get_dirname();
     Filename dir = dtool.get_dirname();
 
 
@@ -491,28 +491,30 @@ bool ConfigPageManager::
 scan_up_from(Filename &result, const Filename &dir, 
 scan_up_from(Filename &result, const Filename &dir, 
              const Filename &suffix) const {
              const Filename &suffix) const {
   Filename consider(dir, suffix);
   Filename consider(dir, suffix);
-
+  
   vector_string files;
   vector_string files;
-  if (consider.scan_directory(files)) {
-    vector_string::const_iterator fi;
-    for (fi = files.begin(); fi != files.end(); ++fi) {
-      Globs::const_iterator gi;
-      for (gi = _prc_patterns.begin();
-           gi != _prc_patterns.end();
-           ++gi) {
-        if ((*gi).matches(*fi)) {
-          result = consider;
-          return true;
-        }
-      }
-      
-      for (gi = _prc_executable_patterns.begin();
-           gi != _prc_executable_patterns.end();
-           ++gi) {
-        if ((*gi).matches(*fi)) {
-          result = consider;
-          return true;
-        }
+  if (consider.is_directory()) {
+    if (consider.scan_directory(files)) {
+      vector_string::const_iterator fi;
+      for (fi = files.begin(); fi != files.end(); ++fi) {
+	Globs::const_iterator gi;
+	for (gi = _prc_patterns.begin();
+	     gi != _prc_patterns.end();
+	     ++gi) {
+	  if ((*gi).matches(*fi)) {
+	    result = consider;
+	    return true;
+	  }
+	}
+	
+	for (gi = _prc_executable_patterns.begin();
+	     gi != _prc_executable_patterns.end();
+	     ++gi) {
+	  if ((*gi).matches(*fi)) {
+	    result = consider;
+	    return true;
+	  }
+	}
       }
       }
     }
     }
   }
   }