diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 31c947054..2a0c23e51 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -197,15 +197,16 @@ OMW::Engine::~Engine() void OMW::Engine::loadBSA() { const Files::MultiDirCollection& bsa = mFileCollections.getCollection (".bsa"); - - for (Files::MultiDirCollection::TIter iter (bsa.begin()); iter!=bsa.end(); ++iter) + 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()); - } + Bsa::addBSA(iter->second.string()); - //std::cout << "Data dir " << mDataDir.string() << std::endl; - //Bsa::addDir(mDataDir.string(), mFSStrict); + dataDirectory = iter->second.parent_path().string(); + std::cout << "Data dir " << dataDirectory << std::endl; + Bsa::addDir(dataDirectory, mFSStrict); + } } // add resources directory diff --git a/components/file_finder/search.cpp b/components/file_finder/search.cpp index eb4392abc..06deaf83a 100644 --- a/components/file_finder/search.cpp +++ b/components/file_finder/search.cpp @@ -4,25 +4,33 @@ void FileFinder::find(const boost::filesystem::path & dir_path, ReturnPath &ret, bool recurse) { - if ( !boost::filesystem::exists( dir_path ) ) + if (boost::filesystem::exists(dir_path)) { - std::cout << "Path " << dir_path << " not found" << std::endl; - return; - } - - boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end - for (boost::filesystem::directory_iterator itr(dir_path); itr != end_itr; ++itr) - { - if (boost::filesystem::is_directory( *itr )) + if (!recurse) { - if (recurse) + boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end + for (boost::filesystem::directory_iterator itr(dir_path); itr != end_itr; ++itr) { - find(*itr, ret); + if (!boost::filesystem::is_directory( *itr )) + { + ret.add(*itr); + } } } else { - ret.add(*itr); + boost::filesystem::recursive_directory_iterator end_itr; // default construction yields past-the-end + for (boost::filesystem::recursive_directory_iterator itr(dir_path); itr != end_itr; ++itr) + { + if (!boost::filesystem::is_directory(*itr)) + { + ret.add(*itr); + } + } } } + else + { + std::cout << "Path " << dir_path << " not found" << std::endl; + } }