From 8ac9dd8e70116eb8adf3f1f34a50a4d9b776fd32 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Fri, 30 Mar 2012 16:59:19 +0200 Subject: [PATCH] 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; }