From a698cdfcfc9edab963d66415e8ee8f4b28081914 Mon Sep 17 00:00:00 2001 From: Oystein Eftevaag Date: Sat, 26 Aug 2006 18:37:49 +0000 Subject: 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 --- engines/kyra/resource.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'engines') 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; -- cgit v1.2.3