mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 20:29:57 +00:00
Issue #133 Handle resources across multiple data directories
Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>
This commit is contained in:
parent
4fae3bd7c6
commit
bcc4d7a7c9
2 changed files with 27 additions and 18 deletions
|
@ -197,15 +197,16 @@ OMW::Engine::~Engine()
|
||||||
void OMW::Engine::loadBSA()
|
void OMW::Engine::loadBSA()
|
||||||
{
|
{
|
||||||
const Files::MultiDirCollection& bsa = mFileCollections.getCollection (".bsa");
|
const Files::MultiDirCollection& bsa = mFileCollections.getCollection (".bsa");
|
||||||
|
std::string dataDirectory;
|
||||||
for (Files::MultiDirCollection::TIter iter (bsa.begin()); iter!=bsa.end(); ++iter)
|
for (Files::MultiDirCollection::TIter iter(bsa.begin()); iter!=bsa.end(); ++iter)
|
||||||
{
|
{
|
||||||
std::cout << "Adding " << iter->second.string() << std::endl;
|
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;
|
dataDirectory = iter->second.parent_path().string();
|
||||||
//Bsa::addDir(mDataDir.string(), mFSStrict);
|
std::cout << "Data dir " << dataDirectory << std::endl;
|
||||||
|
Bsa::addDir(dataDirectory, mFSStrict);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add resources directory
|
// add resources directory
|
||||||
|
|
|
@ -4,25 +4,33 @@
|
||||||
|
|
||||||
void FileFinder::find(const boost::filesystem::path & dir_path, ReturnPath &ret, bool recurse)
|
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;
|
if (!recurse)
|
||||||
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)
|
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
|
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…
Reference in a new issue