- i != m_mods.end(); i++){
- const ModSpec &mod = *i;
- std::string texturepath = mod.path + DIR_DELIM + "textures";
- std::vector<fs::DirListNode> dirlist = fs::GetDirListing(texturepath);
- for(u32 j=0; j<dirlist.size(); j++){
- if(dirlist[j].dir) // Ignode dirs
- continue;
- std::string tname = dirlist[j].name;
- // if name contains illegal characters, ignore the texture
- if(!string_allowed(tname, TEXTURENAME_ALLOWED_CHARS)){
- errorstream<<"Server: ignoring illegal texture name: \""
- <<tname<<"\""<<std::endl;
- continue;
- }
- std::string tpath = texturepath + DIR_DELIM + tname;
- // Read data
- std::ifstream fis(tpath.c_str(), std::ios_base::binary);
- if(fis.good() == false){
- errorstream<<"Server::PrepareTextures(): Could not open \""
- <<tname<<"\" for reading"<<std::endl;
- continue;
- }
- std::ostringstream tmp_os(std::ios_base::binary);
- bool bad = false;
- for(;;){
- char buf[1024];
- fis.read(buf, 1024);
- std::streamsize len = fis.gcount();
- tmp_os.write(buf, len);
- if(fis.eof())
- break;
- if(!fis.good()){
- bad = true;
- break;
- }
- }
- if(bad){
- errorstream<<"Server::PrepareTextures(): Failed to read \""
- <<tname<<"\""<<std::endl;
- continue;
- }
- if(tmp_os.str().length() == 0){
- errorstream<<"Server::PrepareTextures(): Empty file \""
- <<tpath<<"\""<<std::endl;
- continue;
+ i != m_mods.end(); i++){
+ const ModSpec &mod = *i;
+ std::string texturepath = mod.path + DIR_DELIM + "textures";
+ std::vector<fs::DirListNode> dirlist = fs::GetDirListing(texturepath);
+ for(u32 j=0; j<dirlist.size(); j++){
+ if(dirlist[j].dir) // Ignode dirs
+ continue;
+ std::string tname = dirlist[j].name;
+ // if name contains illegal characters, ignore the texture
+ if(!string_allowed(tname, TEXTURENAME_ALLOWED_CHARS)){
+ errorstream<<"Server: ignoring illegal texture name: \""
+ <<tname<<"\""<<std::endl;
+ continue;
+ }
+ std::string tpath = texturepath + DIR_DELIM + tname;
+ // Read data
+ std::ifstream fis(tpath.c_str(), std::ios_base::binary);
+ if(fis.good() == false){
+ errorstream<<"Server::PrepareTextures(): Could not open \""
+ <<tname<<"\" for reading"<<std::endl;
+ continue;
+ }
+ std::ostringstream tmp_os(std::ios_base::binary);
+ bool bad = false;
+ for(;;){
+ char buf[1024];
+ fis.read(buf, 1024);
+ std::streamsize len = fis.gcount();
+ tmp_os.write(buf, len);
+ if(fis.eof())
+ break;
+ if(!fis.good()){
+ bad = true;
+ break;