From 0d163d76ab2aca24a092f54a940132c17bf38679 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Thu, 29 Mar 2012 03:59:24 +0200 Subject: [PATCH 01/14] Replaced some messy code with some differently messy code, this one at least seems to work --- components/bsa/bsa_archive.cpp | 158 ++++++++++++++------------------- 1 file changed, 69 insertions(+), 89 deletions(-) diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index 80d92dd52..0ba93d4ad 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -45,6 +45,32 @@ struct ciLessBoost : std::binary_function } }; +struct mrComparer +{ +private: + int m_start, m_size; + + bool comparePortion(std::string file1, std::string file2, int start, int size) const + { + for(int i = start; i < start+size; i++) + { + char one = tolower(file1.at(i)); + char two = tolower(file2.at(i)); + if(one != two) + return (one < two); + } + return true; + } + +public: + mrComparer(int start, int size) : m_start(start), m_size(size) { } + + bool operator() (const std::string& first, const std::string& other) + { + return comparePortion(first, other, m_start, m_size); + } +}; + static bool fsstrict = false; /// An OGRE Archive wrapping a BSAFile archive @@ -55,16 +81,46 @@ class DirArchive: public Ogre::FileSystemArchive std::map, ciLessBoost> m; unsigned int cutoff; - bool comparePortion(std::string file1, std::string file2, int start, int size) const + bool findFile(const String& filename, std::string& copy) const { - for(int i = start; i < start+size; i++) + copy = filename; + + std::replace(copy.begin(), copy.end(), '\\', '/'); + + if(copy.at(0) == '/') + copy.erase(0, 1); + + if(fsstrict == true) + return true; + + std::string folder; + int delimiter = 0; + size_t lastSlash = copy.rfind('/'); + if (lastSlash != std::string::npos) { - char one = file1.at(i); - char two = file2.at(i); - if(tolower(one) != tolower(two) ) - return false; + folder = copy.substr(0, lastSlash); + delimiter = lastSlash+1; } - return true; + + std::vector current; + { + std::map,ciLessBoost>::const_iterator found = m.find(folder); + if (found == m.end()) + { + std::replace(folder.begin(), folder.end(), '/', '\\'); + found = m.find(folder); + } + + current = found->second; + } + + mrComparer comp(delimiter, copy.size() - delimiter-1); + std::vector::iterator found = std::lower_bound(current.begin(), current.end(), copy, comp); + + if (found != current.end() && !(comp(copy, current.front()))) + return true; + + return false; } public: @@ -120,97 +176,21 @@ class DirArchive: public Ogre::FileSystemArchive void unload() {} bool exists(const String& filename) { - std::string copy = filename; - - - - for (unsigned int i = 0; i < filename.size(); i++) - { - if(copy.at(i) == '\\' ){ - copy.replace(i, 1, "/"); - } - } - - - if(copy.at(0) == '\\' || copy.at(0) == '/') - { - copy.erase(0, 1); - } - if(fsstrict == true) - { - //std::cout << "fsstrict " << copy << "\n"; + std::string copy; + + if (findFile(filename, copy)) return FileSystemArchive::exists(copy); - } - - - int last = copy.size() - 1; - int i = last; - - for (;last >= 0; i--) - { - if(copy.at(i) == '/' || copy.at(i) == '\\') - break; - } - - std::string folder = copy.substr(0, i); //folder with no slash - - std::vector& current = m[folder]; - - for(std::vector::iterator iter = current.begin(); iter != current.end(); iter++) - { - if(comparePortion(*iter, copy, i + 1, copy.size() - i -1) == true){ - return FileSystemArchive::exists(*iter); - } - } - return false; } DataStreamPtr open(const String& filename, bool readonly = true) const { - std::map, ciLessBoost> mlocal = m; - std::string copy = filename; + std::string copy; - - - for (unsigned int i = 0; i < filename.size(); i++) - { - if(copy.at(i) == '\\' ){ - copy.replace(i, 1, "/"); - } - } - - - if(copy.at(0) == '\\' || copy.at(0) == '/') - { - copy.erase(0, 1); - } - - if(fsstrict == true) - { + if (findFile(filename, copy)) return FileSystemArchive::open(copy, readonly); - } - - - int last = copy.size() - 1; - int i = last; - - for (;last >= 0; i--) - { - if(copy.at(i) == '/' || copy.at(i) == '\\') - break; - } - - std::string folder = copy.substr(0, i); //folder with no slash - std::vector current = mlocal[folder]; - - for(std::vector::iterator iter = current.begin(); iter != current.end(); iter++) - { - if(comparePortion(*iter, copy, i + 1, copy.size() - i -1) == true){ - return FileSystemArchive::open(*iter, readonly); - } - } + DataStreamPtr p; return p; } From 71cb85dbc48118f49fc987be053e751d2b7a43b6 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Thu, 29 Mar 2012 04:54:33 +0200 Subject: [PATCH 02/14] Performance enhancment and minor copy-paste fix. --- components/bsa/bsa_archive.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index 0ba93d4ad..3981780bc 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -50,7 +50,7 @@ struct mrComparer private: int m_start, m_size; - bool comparePortion(std::string file1, std::string file2, int start, int size) const + bool comparePortion(const std::string& file1, const std::string& file2, int start, int size) const { for(int i = start; i < start+size; i++) { @@ -59,7 +59,7 @@ private: if(one != two) return (one < two); } - return true; + return false; } public: From ce38876a74b09195d6d20dd82d49e944318b4080 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Thu, 29 Mar 2012 17:31:55 +0200 Subject: [PATCH 03/14] Oops, that could've crashed horribly --- components/bsa/bsa_archive.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index 3981780bc..9a325d160 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -111,7 +111,8 @@ class DirArchive: public Ogre::FileSystemArchive found = m.find(folder); } - current = found->second; + if (found != m.end()) + current = found->second; } mrComparer comp(delimiter, copy.size() - delimiter-1); From c3944d3e1a48220d423849472eb5aebc746185ea Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Thu, 29 Mar 2012 21:27:37 +0200 Subject: [PATCH 04/14] Use a normal binary search --- components/bsa/bsa_archive.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index 9a325d160..a68e91df1 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -116,12 +116,7 @@ class DirArchive: public Ogre::FileSystemArchive } mrComparer comp(delimiter, copy.size() - delimiter-1); - std::vector::iterator found = std::lower_bound(current.begin(), current.end(), copy, comp); - - if (found != current.end() && !(comp(copy, current.front()))) - return true; - - return false; + return std::binary_search(current.begin(), current.end(), copy, comp); } public: From 6acd900577639bc4d83d0a0fcc444f806ab4c2c7 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Thu, 29 Mar 2012 21:36:00 +0200 Subject: [PATCH 05/14] Better name --- components/bsa/bsa_archive.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index a68e91df1..945aae077 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -45,7 +45,7 @@ struct ciLessBoost : std::binary_function } }; -struct mrComparer +struct pathComparer { private: int m_start, m_size; @@ -63,7 +63,7 @@ private: } public: - mrComparer(int start, int size) : m_start(start), m_size(size) { } + pathComparer(int start, int size) : m_start(start), m_size(size) { } bool operator() (const std::string& first, const std::string& other) { @@ -115,7 +115,7 @@ class DirArchive: public Ogre::FileSystemArchive current = found->second; } - mrComparer comp(delimiter, copy.size() - delimiter-1); + pathComparer comp(delimiter, copy.size() - delimiter-1); return std::binary_search(current.begin(), current.end(), copy, comp); } From 60b95e7992f04db17c2a50871e979e71c2ed29bd Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Thu, 29 Mar 2012 22:38:14 +0200 Subject: [PATCH 06/14] Sorting the file lists properly --- components/bsa/bsa_archive.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index 945aae077..64dc97980 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -155,6 +155,7 @@ class DirArchive: public Ogre::FileSystemArchive filesind.push_back(small); } } + std::sort(filesind.begin(), filesind.end(), ciLessBoost()); std::string small; std::string original = d.string(); if(cutoff < original.size()) From 4a9a416d46bb0bd7f2b92615dbde3b81b4975745 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Fri, 30 Mar 2012 14:45:32 +0200 Subject: [PATCH 07/14] Can find files even if no .bsa file exists now --- apps/openmw/engine.cpp | 9 +++++++-- components/bsa/bsa_archive.cpp | 20 +++++++++++++++++++- components/files/collections.cpp | 5 +++++ components/files/collections.hpp | 2 ++ components/nifogre/ogre_nif_loader.cpp | 2 +- 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 5e49ae2f7..990356191 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -204,13 +204,18 @@ OMW::Engine::~Engine() void OMW::Engine::loadBSA() { const Files::MultiDirCollection& bsa = mFileCollections.getCollection (".bsa"); - std::string dataDirectory; + for (Files::MultiDirCollection::TIter iter(bsa.begin()); iter!=bsa.end(); ++iter) { std::cout << "Adding " << iter->second.string() << std::endl; Bsa::addBSA(iter->second.string()); + } - dataDirectory = iter->second.parent_path().string(); + const Files::PathContainer& dataDirs = mFileCollections.getPaths(); + std::string dataDirectory; + for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter) + { + dataDirectory = iter->string(); std::cout << "Data dir " << dataDirectory << std::endl; Bsa::addDir(dataDirectory, mFSStrict); } diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index 64dc97980..36f4b423c 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -52,8 +52,15 @@ private: bool comparePortion(const std::string& file1, const std::string& file2, int start, int size) const { + return lexicographical_compare(file1.substr(start,size), file2.substr(start,size), boost::algorithm::is_iless()); + for(int i = start; i < start+size; i++) { + if (i >= file1.size()) + return true; + else if (i >= file2.size()) + return false; + char one = tolower(file1.at(i)); char two = tolower(file2.at(i)); if(one != two) @@ -83,7 +90,18 @@ class DirArchive: public Ogre::FileSystemArchive bool findFile(const String& filename, std::string& copy) const { - copy = filename; + { + String passed = filename; + if(filename.at(filename.length() - 1) == '*' || filename.at(filename.length() - 1) == '?' || filename.at(filename.length() - 1) == '<' + || filename.at(filename.length() - 1) == '"' || filename.at(filename.length() - 1) == '>' || filename.at(filename.length() - 1) == ':' + || filename.at(filename.length() - 1) == '|') + { + passed = filename.substr(0, filename.length() - 2); + } + if(filename.at(filename.length() - 2) == '>') + passed = filename.substr(0, filename.length() - 6); + copy = passed; + } std::replace(copy.begin(), copy.end(), '\\', '/'); diff --git a/components/files/collections.cpp b/components/files/collections.cpp index 424b558e6..50340dca4 100644 --- a/components/files/collections.cpp +++ b/components/files/collections.cpp @@ -30,4 +30,9 @@ namespace Files return iter->second; } + + const Files::PathContainer& Collections::getPaths() const + { + return mDirectories; + } } diff --git a/components/files/collections.hpp b/components/files/collections.hpp index 1ddca9a5b..70aaec55e 100644 --- a/components/files/collections.hpp +++ b/components/files/collections.hpp @@ -21,6 +21,8 @@ namespace Files /// leading dot and must be all lower-case. const MultiDirCollection& getCollection(const std::string& extension) const; + const Files::PathContainer& getPaths() const; + private: typedef std::map MultiDirCollectionContainer; Files::PathContainer mDirectories; diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index f943231d0..2ab6ae621 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -1368,7 +1368,7 @@ void NIFLoader::loadResource(Resource *resource) if (!vfs->isFile(resourceName)) { - warn("File not found."); + warn("File "+resourceName+" not found."); return; } From d2f8539a4283bfd10c5a2639a64558d763adfd11 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Fri, 30 Mar 2012 14:50:39 +0200 Subject: [PATCH 08/14] Forgot to remove some old code that didn't do anything --- components/bsa/bsa_archive.cpp | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index 36f4b423c..eb392757b 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -50,31 +50,12 @@ struct pathComparer private: int m_start, m_size; - bool comparePortion(const std::string& file1, const std::string& file2, int start, int size) const - { - return lexicographical_compare(file1.substr(start,size), file2.substr(start,size), boost::algorithm::is_iless()); - - for(int i = start; i < start+size; i++) - { - if (i >= file1.size()) - return true; - else if (i >= file2.size()) - return false; - - char one = tolower(file1.at(i)); - char two = tolower(file2.at(i)); - if(one != two) - return (one < two); - } - return false; - } - public: pathComparer(int start, int size) : m_start(start), m_size(size) { } bool operator() (const std::string& first, const std::string& other) { - return comparePortion(first, other, m_start, m_size); + return lexicographical_compare(first.substr(m_start,m_size), other.substr(m_start,m_size), boost::algorithm::is_iless()); } }; From 8ac9dd8e70116eb8adf3f1f34a50a4d9b776fd32 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Fri, 30 Mar 2012 16:59:19 +0200 Subject: [PATCH 09/14] Always use the same type of slashes --- components/bsa/bsa_archive.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index eb392757b..e33f0ba49 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -104,13 +104,10 @@ class DirArchive: public Ogre::FileSystemArchive std::vector current; { std::map,ciLessBoost>::const_iterator found = m.find(folder); - if (found == m.end()) - { - std::replace(folder.begin(), folder.end(), '/', '\\'); - found = m.find(folder); - } - if (found != m.end()) + if (found == m.end()) + return false; + else current = found->second; } @@ -134,16 +131,14 @@ class DirArchive: public Ogre::FileSystemArchive //need to cut off first boost::filesystem::directory_iterator dir_iter(d), dir_end; std::vector filesind; - boost::filesystem::path f; for(;dir_iter != dir_end; dir_iter++) { if(boost::filesystem::is_directory(*dir_iter)) populateMap(*dir_iter); else { - - f = *dir_iter; - std::string s = f.string(); + std::string s = dir_iter->path().string(); + std::replace(s.begin(), s.end(), '\\', '/'); std::string small; if(cutoff < s.size()) @@ -155,14 +150,16 @@ class DirArchive: public Ogre::FileSystemArchive } } std::sort(filesind.begin(), filesind.end(), ciLessBoost()); + std::string small; std::string original = d.string(); + std::replace(original.begin(), original.end(), '\\', '/'); if(cutoff < original.size()) small = original.substr(cutoff, original.size() - cutoff); else small = original.substr(cutoff - 1, original.size() - cutoff); - m[small] = filesind; + m[small] = filesind; } bool isCaseSensitive() const { return fsstrict; } From fc4e4dc336feb15584875f651e88f1cd0936a8e6 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Fri, 30 Mar 2012 19:05:58 +0200 Subject: [PATCH 10/14] Case sensitiviy? --- components/bsa/bsa_archive.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index e33f0ba49..bd61e0339 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -112,7 +112,13 @@ class DirArchive: public Ogre::FileSystemArchive } pathComparer comp(delimiter, copy.size() - delimiter-1); - return std::binary_search(current.begin(), current.end(), copy, comp); + std::vector::iterator find = std::lower_bound(current.begin(), current.end(), copy, comp); + if (find != current.end() && !comp(copy, current.front())) + { + copy = *find; + return true; + } + return false; } public: From 8d9100c77b7fd67df4c18a1642beffcf3bc68b72 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Fri, 30 Mar 2012 23:29:58 +0200 Subject: [PATCH 11/14] Debug output --- components/bsa/bsa_archive.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index bd61e0339..9d7212a5c 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -101,12 +101,17 @@ class DirArchive: public Ogre::FileSystemArchive delimiter = lastSlash+1; } + std::cout << "Finding: " << copy; + std::vector current; { std::map,ciLessBoost>::const_iterator found = m.find(folder); if (found == m.end()) + { + std::cout << " failed, couldn't find folder." << std::endl; return false; + } else current = found->second; } @@ -115,9 +120,18 @@ class DirArchive: public Ogre::FileSystemArchive std::vector::iterator find = std::lower_bound(current.begin(), current.end(), copy, comp); if (find != current.end() && !comp(copy, current.front())) { + std::cout << " found"; + if (copy != *find) + if (lexicographical_compare(copy, *find, boost::algorithm::is_iless())) + std::cout << " case folded to " << *find << std::endl; + else + std::cout << " as different file " << *find << std::endl; + copy = *find; return true; } + + std::cout << " failed, couldn't find file." << std::endl; return false; } From 8e07b7e05002e246d785b3c6d7b35ace6bdb68b1 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Sat, 31 Mar 2012 00:54:49 +0200 Subject: [PATCH 12/14] Better (less) debug output --- components/bsa/bsa_archive.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index 9d7212a5c..650127159 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -101,37 +101,34 @@ class DirArchive: public Ogre::FileSystemArchive delimiter = lastSlash+1; } - std::cout << "Finding: " << copy; - std::vector current; { std::map,ciLessBoost>::const_iterator found = m.find(folder); if (found == m.end()) { - std::cout << " failed, couldn't find folder." << std::endl; return false; } else current = found->second; } + std::cout << "Finding: " << copy; + pathComparer comp(delimiter, copy.size() - delimiter-1); std::vector::iterator find = std::lower_bound(current.begin(), current.end(), copy, comp); if (find != current.end() && !comp(copy, current.front())) { std::cout << " found"; - if (copy != *find) - if (lexicographical_compare(copy, *find, boost::algorithm::is_iless())) - std::cout << " case folded to " << *find << std::endl; - else - std::cout << " as different file " << *find << std::endl; + if (copy != *find && !lexicographical_compare(copy, *find, boost::algorithm::is_iless())) + std::cout << ", as different file " << *find; + std::cout << "." << std::endl; copy = *find; return true; } - std::cout << " failed, couldn't find file." << std::endl; + std::cout << " failed." << std::endl; return false; } From 06a34b9e0d9edf3060690094ec8ed8a0c1194c77 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Sat, 31 Mar 2012 10:35:08 +0200 Subject: [PATCH 13/14] Strange problems call for strange solutions. --- components/bsa/bsa_archive.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index 650127159..660b24d56 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -71,6 +71,9 @@ class DirArchive: public Ogre::FileSystemArchive bool findFile(const String& filename, std::string& copy) const { + if (filename.find(".tga") != std::string::npos) + return false; + { String passed = filename; if(filename.at(filename.length() - 1) == '*' || filename.at(filename.length() - 1) == '?' || filename.at(filename.length() - 1) == '<' @@ -120,8 +123,8 @@ class DirArchive: public Ogre::FileSystemArchive if (find != current.end() && !comp(copy, current.front())) { std::cout << " found"; - if (copy != *find && !lexicographical_compare(copy, *find, boost::algorithm::is_iless())) - std::cout << ", as different file " << *find; + if (copy != *find && !lexicographical_compare(copy, *find, boost::algorithm::is_iequal())) + std::cout << ", as different file " << *find; std::cout << "." << std::endl; copy = *find; From 3b0dc408ae1866b5a0d702b8fce6e453eb697b47 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Sat, 31 Mar 2012 11:29:24 +0200 Subject: [PATCH 14/14] Debug-b-gone --- components/bsa/bsa_archive.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index 660b24d56..41bff7e40 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -71,9 +71,6 @@ class DirArchive: public Ogre::FileSystemArchive bool findFile(const String& filename, std::string& copy) const { - if (filename.find(".tga") != std::string::npos) - return false; - { String passed = filename; if(filename.at(filename.length() - 1) == '*' || filename.at(filename.length() - 1) == '?' || filename.at(filename.length() - 1) == '<' @@ -116,22 +113,14 @@ class DirArchive: public Ogre::FileSystemArchive current = found->second; } - std::cout << "Finding: " << copy; - pathComparer comp(delimiter, copy.size() - delimiter-1); std::vector::iterator find = std::lower_bound(current.begin(), current.end(), copy, comp); if (find != current.end() && !comp(copy, current.front())) { - std::cout << " found"; - if (copy != *find && !lexicographical_compare(copy, *find, boost::algorithm::is_iequal())) - std::cout << ", as different file " << *find; - - std::cout << "." << std::endl; copy = *find; return true; } - std::cout << " failed." << std::endl; return false; }