Browse Source

avoid low-level case-sensitive issues

David Rose 16 years ago
parent
commit
ed32f2264e

+ 3 - 1
dtool/src/dtoolutil/executionEnvironment.cxx

@@ -168,7 +168,9 @@ get_cwd() {
     assert(buffer != (char *)NULL);
   }
 
-  return Filename::from_os_specific(buffer);
+  Filename cwd = Filename::from_os_specific(buffer);
+  cwd.make_true_case();
+  return cwd;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 7 - 3
dtool/src/dtoolutil/filename.cxx

@@ -413,12 +413,16 @@ from_os_specific(const string &os_specific, Filename::Type type) {
 //       Access: Published, Static
 //  Description: Returns the same thing as from_os_specific(), but
 //               embedded environment variable references
-//               (e.g. "$DMODELS/foo.txt") are expanded out.
+//               (e.g. "$DMODELS/foo.txt") are expanded out.  It also
+//               automatically elevates the file to its true case if
+//               needed.
 ////////////////////////////////////////////////////////////////////
 Filename Filename::
 expand_from(const string &os_specific, Filename::Type type) {
-  return from_os_specific(ExecutionEnvironment::expand_string(os_specific),
-                          type);
+  Filename file = from_os_specific(ExecutionEnvironment::expand_string(os_specific),
+                                   type);
+  file.make_true_case();
+  return file;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 2 - 0
dtool/src/prc/configPageManager.cxx

@@ -164,6 +164,7 @@ reload_implicit_pages() {
       string prc_dir = ExecutionEnvironment::get_environment_variable(prc_dir_envvar_list[i]);
       if (!prc_dir.empty()) {
         Filename prc_dir_filename = Filename::from_os_specific(prc_dir);
+        prc_dir_filename.make_true_case();
         if (scan_auto_prc_dir(prc_dir_filename)) {
           _search_path.append_directory(prc_dir_filename);
         }
@@ -188,6 +189,7 @@ reload_implicit_pages() {
           q = path.length();
         }
         Filename prc_dir_filename = Filename::from_os_specific(path.substr(p, q - p));
+        prc_dir_filename.make_true_case();
         if (scan_auto_prc_dir(prc_dir_filename)) {
           _search_path.append_directory(prc_dir_filename);
         }

+ 3 - 1
dtool/src/prc/configVariableSearchPath.cxx

@@ -39,7 +39,9 @@ reload_search_path() {
     string expanded = ExecutionEnvironment::expand_string(decl->get_string_value());
     ExecutionEnvironment::clear_shadow("THIS_PRC_DIR");
     if (!expanded.empty()) {
-      _cache.append_directory(Filename::from_os_specific(expanded));
+      Filename dir = Filename::from_os_specific(expanded);
+      dir.make_true_case();
+      _cache.append_directory(dir);
     }
   }
 

+ 7 - 1
panda/src/express/virtualFileSystem.cxx

@@ -36,7 +36,13 @@ VirtualFileSystem *VirtualFileSystem::_global_ptr = NULL;
 VirtualFileSystem::
 VirtualFileSystem() :
   vfs_case_sensitive
-("vfs-case-sensitive", true,
+("vfs-case-sensitive", 
+#ifdef NDEBUG
+ false,  // The default for a production build is not case-sensitive;
+         // this avoids runtime overhead to verify case sensitivity.
+#else
+ true,
+#endif
  PRC_DESC("Set this true to make the VirtualFileSystem present the native "
           "OS-provided filesystem as if it were a case-sensitive file "
           "system, even if it is not (e.g. on Windows).  This variable "