diff options
author | Max Horn | 2008-09-27 23:00:46 +0000 |
---|---|---|
committer | Max Horn | 2008-09-27 23:00:46 +0000 |
commit | c549a0e708f297f9724b55ad6d72ba32a60f6bbd (patch) | |
tree | 91c8b4cb2a3e8eb1d27a0ad4c1299f8ffb7cc3a8 /common | |
parent | 2e9ddbb09cb6851200e0e9aff164d22dfcb7757c (diff) | |
download | scummvm-rg350-c549a0e708f297f9724b55ad6d72ba32a60f6bbd.tar.gz scummvm-rg350-c549a0e708f297f9724b55ad6d72ba32a60f6bbd.tar.bz2 scummvm-rg350-c549a0e708f297f9724b55ad6d72ba32a60f6bbd.zip |
Changed Common::File to use SearchMan
svn-id: r34663
Diffstat (limited to 'common')
-rw-r--r-- | common/file.cpp | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/common/file.cpp b/common/file.cpp index cf396a32cd..0ddeb93324 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -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 @@ void File::addDefaultDirectoryRecursive(const FilesystemNode &dir, int level) { 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 @@ bool File::open(const String &filename) { _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::open(const FilesystemNode &node) { } 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; |