avoid low-level case-sensitive issues

This commit is contained in:
David Rose 2009-12-31 19:58:36 +00:00
parent 352c901aa1
commit ed32f2264e
5 changed files with 22 additions and 6 deletions

View File

@ -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;
}
////////////////////////////////////////////////////////////////////

View File

@ -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;
}
////////////////////////////////////////////////////////////////////

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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 "