|
|
|
@ -67,11 +67,11 @@ class DirArchive: public Ogre::FileSystemArchive
|
|
|
|
|
|
|
|
|
|
DirArchive(const String& name)
|
|
|
|
|
: FileSystemArchive(name, "Dir")
|
|
|
|
|
{ mType = "Dir";
|
|
|
|
|
{
|
|
|
|
|
mType = "Dir";
|
|
|
|
|
currentdir = name;
|
|
|
|
|
std::string s = name;
|
|
|
|
|
cutoff = s.size() + 1;
|
|
|
|
|
//std::cout << "Cut off:" << cutoff;
|
|
|
|
|
if(fsstrict == false)
|
|
|
|
|
populateMap(currentdir);
|
|
|
|
|
|
|
|
|
@ -98,7 +98,6 @@ class DirArchive: public Ogre::FileSystemArchive
|
|
|
|
|
small = s.substr(cutoff - 1, s.size() - cutoff);
|
|
|
|
|
|
|
|
|
|
filesind.push_back(small);
|
|
|
|
|
//std::cout << "File: " << small << "f\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
std::string small;
|
|
|
|
@ -107,9 +106,7 @@ class DirArchive: public Ogre::FileSystemArchive
|
|
|
|
|
small = original.substr(cutoff, original.size() - cutoff);
|
|
|
|
|
else
|
|
|
|
|
small = original.substr(cutoff - 1, original.size() - cutoff);
|
|
|
|
|
//boost::filesystem::path smallp = small;
|
|
|
|
|
m[small] = filesind;
|
|
|
|
|
//std::cout << "Directory: " << small << " " << filesind.size() << "\n";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -120,12 +117,6 @@ class DirArchive: public Ogre::FileSystemArchive
|
|
|
|
|
void unload() {}
|
|
|
|
|
|
|
|
|
|
bool exists(const String& filename) {
|
|
|
|
|
//std::cout << "exists\n";
|
|
|
|
|
//String s = filename;
|
|
|
|
|
//FileSystemArchive::findFiles(s, true, false, filenames.getPointer(), f.getPointer());
|
|
|
|
|
// std::cout << "Filenames" << filenames.useCount() << "\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string copy = filename;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -140,10 +131,7 @@ class DirArchive: public Ogre::FileSystemArchive
|
|
|
|
|
|
|
|
|
|
if(copy.at(0) == '\\' || copy.at(0) == '/')
|
|
|
|
|
{
|
|
|
|
|
//std::cout << "Before:" << copy.size() << "\n";
|
|
|
|
|
copy.erase(0, 1);
|
|
|
|
|
//std::cout << "The copy" << copy << "\n";
|
|
|
|
|
//std::cout << "After:" << copy.size();
|
|
|
|
|
}
|
|
|
|
|
if(fsstrict == true)
|
|
|
|
|
{
|
|
|
|
@ -162,36 +150,23 @@ class DirArchive: public Ogre::FileSystemArchive
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//std::string file = copy.substr(i + 1, copy.size() - i); //filename with no slash
|
|
|
|
|
std::string folder = copy.substr(0, i); //folder with no slash
|
|
|
|
|
|
|
|
|
|
//std::transform(file.begin(), file.end(), file.begin(), tolower);
|
|
|
|
|
//boost::filesystem::path folderpath = folder;
|
|
|
|
|
std::vector<std::string> current = m[folder];
|
|
|
|
|
|
|
|
|
|
for(std::vector<std::string>::iterator iter = current.begin(); iter != current.end(); iter++)
|
|
|
|
|
{
|
|
|
|
|
//std::string loopfile = iter->substr(i + 1, copy.size() - i); //filename with no slash
|
|
|
|
|
//std::transform(loopfile.begin(), loopfile.end(), loopfile.begin(), tolower);
|
|
|
|
|
//std::string now = *iter;
|
|
|
|
|
if(comparePortion(*iter, copy, i + 1, copy.size() - i -1) == true){
|
|
|
|
|
//std::cout << "Loopfile:" << copy << "\n";
|
|
|
|
|
return FileSystemArchive::exists(*iter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//std::cout << "Filename:" << file << "\n";
|
|
|
|
|
//std::cout << "Full:" << p.string() << "\n";
|
|
|
|
|
//std::cout << "Current:" << folder << "size: " << current.size() << "\n";
|
|
|
|
|
//std::cout << "\nFull:" << p.string() << "\n"<< "Part:" << folderpath.string();
|
|
|
|
|
|
|
|
|
|
return false;//FileSystemArchive::exists(copy);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DataStreamPtr open(const String& filename, bool readonly = true) const
|
|
|
|
|
{
|
|
|
|
|
std::map<std::string, std::vector<std::string>, ciLessBoost> mlocal = m;
|
|
|
|
|
//std::cout << "Open\n";
|
|
|
|
|
std::string copy = filename;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -206,17 +181,13 @@ class DirArchive: public Ogre::FileSystemArchive
|
|
|
|
|
|
|
|
|
|
if(copy.at(0) == '\\' || copy.at(0) == '/')
|
|
|
|
|
{
|
|
|
|
|
//std::cout << "Before:" << copy.size() << "\n";
|
|
|
|
|
copy.erase(0, 1);
|
|
|
|
|
//std::cout << "The copy" << copy << "\n";
|
|
|
|
|
//std::cout << "After:" << copy.size();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(fsstrict == true){
|
|
|
|
|
return FileSystemArchive::open(copy, readonly);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//boost::filesystem::path p = copy;
|
|
|
|
|
|
|
|
|
|
int last = copy.size() - 1;
|
|
|
|
|
int i = last;
|
|
|
|
@ -227,28 +198,17 @@ class DirArchive: public Ogre::FileSystemArchive
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string folder = copy.substr(0, i); //folder with no slash //folder with no slash
|
|
|
|
|
|
|
|
|
|
//std::transform(file.begin(), file.end(), file.begin(), tolower);
|
|
|
|
|
//boost::filesystem::path folderpath = folder;
|
|
|
|
|
std::string folder = copy.substr(0, i); //folder with no slash
|
|
|
|
|
std::vector<std::string> current = mlocal[folder];
|
|
|
|
|
|
|
|
|
|
for(std::vector<std::string>::iterator iter = current.begin(); iter != current.end(); iter++)
|
|
|
|
|
{
|
|
|
|
|
//std::string loopfile = iter->substr(i + 1, copy.size() - i); //filename with no slash
|
|
|
|
|
//std::transform(loopfile.begin(), loopfile.end(), loopfile.begin(), tolower);
|
|
|
|
|
if(comparePortion(*iter, copy, i + 1, copy.size() - i -1) == true){
|
|
|
|
|
//std::cout << "Loopfile:" << copy << "\n";
|
|
|
|
|
return FileSystemArchive::open(*iter, readonly);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//std::cout << "Filename:" << file << "\n";
|
|
|
|
|
//std::cout << "Full:" << p.string() << "\n";
|
|
|
|
|
//std::cout << "Current:" << folder << "size: " << current.size() << "\n";
|
|
|
|
|
//std::cout << "\nFull:" << p.string() << "\n"<< "Part:" << folderpath.string();
|
|
|
|
|
DataStreamPtr p;
|
|
|
|
|
return p;//FileSystemArchive::open(copy, readonly);
|
|
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|