be explicit with vfs->open_read_file(), etc.

This commit is contained in:
David Rose 2006-01-25 22:18:07 +00:00
parent bcef4b24de
commit ef9dfea9df
7 changed files with 14 additions and 38 deletions

View File

@ -140,7 +140,7 @@ read(Filename filename) {
#ifdef WITHIN_PANDA
filename.set_text();
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
istream *in = vfs->open_read_file(filename);
istream *in = vfs->open_read_file(filename, true);
if (in == (istream *)NULL) {
cerr << "Cannot open " << filename << " for reading.\n";
return false;

View File

@ -203,15 +203,9 @@ get_sound(const string &file_name, bool positional) {
for (type_i = _supported_types.begin(); type_i != _supported_types.end(); ++type_i) {
path.set_extension(*type_i); // set extension as supported type
if (use_vfs) { // check virtual file system
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
if (vfs->resolve_filename(path, get_sound_path())) {
break; // break out of loop with a valid type_i value and path with correct extension
}
} else { // check regular file system
if (path.resolve_filename(get_sound_path())) {
break; // break out of loop with a valid type_i value and path with correct extension
}
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
if (vfs->resolve_filename(path, get_sound_path())) {
break; // break out of loop with a valid type_i value and path with correct extension
}
} // end for loop
// if no valid file found
@ -344,12 +338,8 @@ uncache_sound(const string& file_name) {
nassertv(is_valid());
Filename path = file_name;
if (use_vfs) {
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
vfs->resolve_filename(path, get_sound_path());
} else {
path.resolve_filename(get_sound_path());
}
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
vfs->resolve_filename(path, get_sound_path());
audio_debug(" path=\""<<path<<"\"");
SoundMap::iterator itor = _sounds.find(path);
if (itor == _sounds.end()) {

View File

@ -791,7 +791,7 @@ load_client_certificate() {
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
if (!vfs->read_file(_client_certificate_filename,
_client_certificate_pem)) {
_client_certificate_pem, true)) {
// Could not find or read file.
downloader_cat.warning()
<< "Could not read " << _client_certificate_filename << ".\n";
@ -914,16 +914,7 @@ parse_http_version_string(const string &version) {
////////////////////////////////////////////////////////////////////
bool HTTPClient::
load_certificates(const Filename &filename) {
int result;
if (use_vfs) {
result = load_verify_locations(_ssl_ctx, filename);
} else {
string os_specific = filename.to_os_specific();
result =
SSL_CTX_load_verify_locations(_ssl_ctx, os_specific.c_str(), NULL);
}
int result = load_verify_locations(_ssl_ctx, filename);
if (result <= 0) {
downloader_cat.info()
@ -1398,7 +1389,7 @@ load_verify_locations(SSL_CTX *ctx, const Filename &ca_file) {
// First, read the complete file into memory.
string data;
if (!vfs->read_file(ca_file, data)) {
if (!vfs->read_file(ca_file, data, true)) {
// Could not find or read file.
downloader_cat.info()
<< "Could not read " << ca_file << ".\n";

View File

@ -205,7 +205,7 @@ bool HashVal::
hash_file(const Filename &filename) {
Filename bin_filename = Filename::binary_filename(filename);
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
istream *istr = vfs->open_read_file(bin_filename);
istream *istr = vfs->open_read_file(bin_filename, false);
if (istr == (istream *)NULL) {
(*this) = HashVal();
return false;

View File

@ -77,7 +77,7 @@ load(const Filename &file, int preprocessor) {
result->_preprocessor = preprocessor;
result->_fixed_expansion = 0;
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
if (!vfs->read_file(file, result->_body)) {
if (!vfs->read_file(file, result->_body, true)) {
cerr << "Could not read shader file: " << file << "\n";
result->_body = "";
}

View File

@ -53,7 +53,7 @@ load_prc_file(const string &filename) {
vfs->resolve_filename(path, cp_mgr->get_search_path()) ||
vfs->resolve_filename(path, get_model_path());
istream *file = vfs->open_read_file(path);
istream *file = vfs->open_read_file(path, true);
if (file == (istream *)NULL) {
util_cat.error()
<< "Unable to open " << path << "\n";

View File

@ -233,13 +233,8 @@ lookup_filename(const string &str, string &index_str,
}
// Now look up the filename on the model path.
if (use_vfs) {
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
vfs->resolve_filename(filename, get_model_path());
} else {
filename.resolve_filename(get_model_path());
}
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
vfs->resolve_filename(filename, get_model_path());
ostringstream strm;
strm << filename << ":" << face_index;