[Scummvm-cvs-logs] SF.net SVN: scummvm:[34663] scummvm/trunk/common/file.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Sep 28 01:00:47 CEST 2008


Revision: 34663
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34663&view=rev
Author:   fingolfin
Date:     2008-09-27 23:00:46 +0000 (Sat, 27 Sep 2008)

Log Message:
-----------
Changed Common::File to use SearchMan

Modified Paths:
--------------
    scummvm/trunk/common/file.cpp

Modified: scummvm/trunk/common/file.cpp
===================================================================
--- scummvm/trunk/common/file.cpp	2008-09-27 20:04:06 UTC (rev 34662)
+++ scummvm/trunk/common/file.cpp	2008-09-27 23:00:46 UTC (rev 34663)
@@ -31,9 +31,6 @@
 
 namespace Common {
 
-static Common::SearchSet *s_searchSet = 0;
-
-
 void File::addDefaultDirectory(const String &directory) {
 	FilesystemNode dir(directory);
 	addDefaultDirectoryRecursive(dir, 1);
@@ -52,18 +49,12 @@
 	if (level <= 0 || !dir.exists() || !dir.isDirectory())
 		return;
 
-	if (!s_searchSet) {
-		s_searchSet = new Common::SearchSet();
-		g_system->addSysArchivesToSearchSet(*s_searchSet);
-	}
-
 	Common::ArchivePtr dataArchive(new Common::FSDirectory(dir, level));
-	s_searchSet->add(dir.getPath(), dataArchive, 1);
+	SearchMan.add(dir.getPath(), dataArchive);
 }
 
 void File::resetDefaultDirectories() {
-	delete s_searchSet;
-	s_searchSet = 0;
+	SearchMan.clear();
 }
 
 File::File()
@@ -82,14 +73,14 @@
 	_name.clear();
 	clearIOFailed();
 
-	if (s_searchSet && s_searchSet->hasFile(filename)) {
+	if (SearchMan.hasFile(filename)) {
 		debug(3, "Opening hashed: %s", filename.c_str());
-		_handle = s_searchSet->openFile(filename);
-	} else if (s_searchSet && s_searchSet->hasFile(filename + ".")) {
+		_handle = SearchMan.openFile(filename);
+	} else if (SearchMan.hasFile(filename + ".")) {
 		// WORKAROUND: Bug #1458388: "SIMON1: Game Detection fails"
 		// sometimes instead of "GAMEPC" we get "GAMEPC." (note trailing dot)
 		debug(3, "Opening hashed: %s.", filename.c_str());
-		_handle = s_searchSet->openFile(filename);
+		_handle = SearchMan.openFile(filename);
 	} else {
 		// Last resort: try the current directory
 		FilesystemNode file(filename);
@@ -135,9 +126,9 @@
 }
 
 bool File::exists(const String &filename) {
-	if (s_searchSet && s_searchSet->hasFile(filename)) {
+	if (SearchMan.hasFile(filename)) {
 		return true;
-	} else if (s_searchSet && s_searchSet->hasFile(filename + ".")) {
+	} else if (SearchMan.hasFile(filename + ".")) {
 		// WORKAROUND: Bug #1458388: "SIMON1: Game Detection fails"
 		// sometimes instead of "GAMEPC" we get "GAMEPC." (note trailing dot)
 		return true;


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