Kaynağa Gözat

configpath defaults to .:/fat/people/drose:/usr/local/etc

David Rose 23 yıl önce
ebeveyn
işleme
3bb494bbf0

+ 1 - 9
dtool/src/dconfig/configTable.I

@@ -49,15 +49,7 @@ INLINE void ConfigTable::ConfigSuffixDefault(void) {
 }
 
 INLINE void ConfigTable::ConfigPathDefault(void) {
-#ifdef PENV_PS2
-
-  // When this is empty, ReadConfigFile (ConfigTable.C) is forced
-  // to look in CONFIG_PATH compiler_flag (instead of env var)
-
-  configpath = "";
-#else
-  configpath = "CONFIG_PATH";
-#endif
+  configpath = "CFG_PATH";
 }
 
 INLINE void ConfigTable::ConfigCmtDefault(void) {

+ 24 - 35
dtool/src/dconfig/configTable.cxx

@@ -120,45 +120,34 @@ void ConfigTable::ParseConfigFile(istream& is, const ConfigString& Filename)
 }
 
 void ConfigTable::ReadConfigFile(void) {
-  if (configpath.empty()) {
-
-#ifdef PENV_PS2
-
-    // roight. PS2 has no environment variables, so the config path
-    // has to be explicitly set with the CONFIG_PATH compiler variable.
-    // this is currently done in makefile.config.so...
+  // The configpath variable lists the environment variables that
+  // themselves should be considered to contain search paths for
+  // Configrc files.  This is one level of indirection from the
+  // intuitive definition.
+
+  DSearchPath config_search;
+  while (!configpath.empty()) {
+    int i = configpath.find_first_of(" ");
+    ConfigString stmp = configpath.substr(0, i);
+    if (ExecutionEnvironment::has_environment_variable(stmp)) {
+      config_search.append_path(ExecutionEnvironment::get_environment_variable(stmp));
+    }
+    configpath.erase(0, i);
+    CropString(configpath);
+  }
 
-    // CSN.
+  if (config_search.is_empty()) {
+    // If we still have no directories on the search path, then at
+    // least search the current directory.
+    config_search.append_directory(".");
+  }
 
-#ifndef CONFIG_PATH
-#define CONFIG_PATH "."
-#endif
-    configpath = CONFIG_PATH;
-#else
-    configpath = ".";
-#endif
-  } else {
-    ConfigString S;
-    while (!configpath.empty()) {
-      int i = configpath.find_first_of(" ");
-      ConfigString stmp = configpath.substr(0, i);
-      if (ExecutionEnvironment::has_environment_variable(stmp)) {
-        S += " ";
-        S += ExecutionEnvironment::get_environment_variable(stmp);
-      }
-      configpath.erase(0, i);
-      CropString(configpath);
-    }
-    if (S.empty())
-      S = ".";
-    CropString(S);
-    configpath = S;
+  if (microconfig_cat->is_spam()) {
+    microconfig_cat->spam()
+      << "search path from configpath is: " 
+      << config_search << endl;
   }
-  if (microconfig_cat->is_spam())
-    microconfig_cat->spam() << "evaluated value of configpath '"
-                            << configpath << "'" << endl;
 
-  DSearchPath config_search(configpath);
   DSearchPath::Results config_files;
 
   if (!configsuffix.empty()) {