mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-22 03:40:49 +00:00
Can find files even if no .bsa file exists now
This commit is contained in:
parent
60b95e7992
commit
4a9a416d46
@ -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);
|
||||
}
|
||||
|
@ -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(), '\\', '/');
|
||||
|
||||
|
@ -30,4 +30,9 @@ namespace Files
|
||||
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
const Files::PathContainer& Collections::getPaths() const
|
||||
{
|
||||
return mDirectories;
|
||||
}
|
||||
}
|
||||
|
@ -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<std::string, MultiDirCollection> MultiDirCollectionContainer;
|
||||
Files::PathContainer mDirectories;
|
||||
|
@ -1368,7 +1368,7 @@ void NIFLoader::loadResource(Resource *resource)
|
||||
|
||||
if (!vfs->isFile(resourceName))
|
||||
{
|
||||
warn("File not found.");
|
||||
warn("File "+resourceName+" not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user