diff options
author | Oystein Eftevaag | 2006-08-26 18:37:49 +0000 |
---|---|---|
committer | Oystein Eftevaag | 2006-08-26 18:37:49 +0000 |
commit | a698cdfcfc9edab963d66415e8ee8f4b28081914 (patch) | |
tree | 3f6a931817dd790f4ffd2fb53b66ede86b81cfa3 /engines | |
parent | c28011aed5e6922d3693b070f3a7911916e65ee6 (diff) | |
download | scummvm-rg350-a698cdfcfc9edab963d66415e8ee8f4b28081914.tar.gz scummvm-rg350-a698cdfcfc9edab963d66415e8ee8f4b28081914.tar.bz2 scummvm-rg350-a698cdfcfc9edab963d66415e8ee8f4b28081914.zip |
Catalog the PAK files by base name instead of full path name so we can properly unload them. The method may be slightly hackish, but I don't see how else to do it since we apparently support recursive PAK files so the File object can't be instantiated directly using the FilesystemNode. It's this, or add a function to File that gives us just the base name of the file.
svn-id: r23762
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/resource.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp index 2109210e09..d5570a5e9b 100644 --- a/engines/kyra/resource.cpp +++ b/engines/kyra/resource.cpp @@ -94,6 +94,8 @@ bool Resource::loadPakFile(const Common::String &filename) { return true; uint32 size = 0; + FilesystemNode *fsNode = new FilesystemNode(filename); + Common::File handle; if (!fileHandle(filename.c_str(), &size, handle)) { warning("couldn't load file: '%s'", filename.c_str()); @@ -103,15 +105,16 @@ bool Resource::loadPakFile(const Common::String &filename) { PAKFile *file = 0; if (handle.name() == filename) { - file = new PAKFile(filename.c_str(), (_engine->features() & GF_AMIGA) != 0); + file = new PAKFile(fsNode->name().c_str(), (_engine->features() & GF_AMIGA) != 0); } else { uint32 offset = handle.pos(); uint8 *buf = new uint8[size]; handle.read(buf, size); - file = new PAKFile(filename.c_str(), handle.name(), offset, buf, size, (_engine->features() & GF_AMIGA) != 0); + file = new PAKFile(fsNode->name().c_str(), handle.name(), offset, buf, size, (_engine->features() & GF_AMIGA) != 0); delete [] buf; } handle.close(); + delete fsNode; if (!file) return false; |