[Scummvm-cvs-logs] SF.net SVN: scummvm: [23762] scummvm/trunk/engines/kyra/resource.cpp

vinterstum at users.sourceforge.net vinterstum at users.sourceforge.net
Sat Aug 26 20:37:56 CEST 2006


Revision: 23762
Author:   vinterstum
Date:     2006-08-26 11:37:49 -0700 (Sat, 26 Aug 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=23762&view=rev

Log Message:
-----------
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.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/resource.cpp
Modified: scummvm/trunk/engines/kyra/resource.cpp
===================================================================
--- scummvm/trunk/engines/kyra/resource.cpp	2006-08-26 15:11:51 UTC (rev 23761)
+++ scummvm/trunk/engines/kyra/resource.cpp	2006-08-26 18:37:49 UTC (rev 23762)
@@ -94,6 +94,8 @@
 		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 @@
 	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;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list