mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
fix broken implicit-unwrapping of pz files
This commit is contained in:
parent
d552ad28b7
commit
999bae8044
@ -94,15 +94,25 @@ is_regular_file() const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
istream *VirtualFileSimple::
|
istream *VirtualFileSimple::
|
||||||
open_read_file(bool auto_unwrap) const {
|
open_read_file(bool auto_unwrap) const {
|
||||||
istream *result = _mount->open_read_file(_local_filename);
|
|
||||||
|
// Will we be automatically unwrapping a .pz file?
|
||||||
|
bool do_unwrap = (_implicit_pz_file || (auto_unwrap && _local_filename.get_extension() == "pz"));
|
||||||
|
|
||||||
|
Filename local_filename(_local_filename);
|
||||||
|
if (do_unwrap) {
|
||||||
|
// .pz files are always binary, of course.
|
||||||
|
local_filename.set_binary();
|
||||||
|
}
|
||||||
|
|
||||||
|
istream *result = _mount->open_read_file(local_filename);
|
||||||
#ifdef HAVE_ZLIB
|
#ifdef HAVE_ZLIB
|
||||||
if (result != (istream *)NULL &&
|
if (result != (istream *)NULL && do_unwrap) {
|
||||||
(_implicit_pz_file || (auto_unwrap && _local_filename.get_extension() == "pz"))) {
|
|
||||||
// We have to slip in a layer to decompress the file on the fly.
|
// We have to slip in a layer to decompress the file on the fly.
|
||||||
IDecompressStream *wrapper = new IDecompressStream(result, true);
|
IDecompressStream *wrapper = new IDecompressStream(result, true);
|
||||||
result = wrapper;
|
result = wrapper;
|
||||||
}
|
}
|
||||||
#endif // HAVE_ZLIB
|
#endif // HAVE_ZLIB
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user