Issue #133 Handle resources across multiple data directories

Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>
actorid
Lukasz Gromanowski 13 years ago
parent 4fae3bd7c6
commit bcc4d7a7c9

@ -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

@ -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;
}
}

Loading…
Cancel
Save