comparison engine/core/vfs/vfs.cpp @ 337:f9aca52c7c45

VFS: * Emit warning for upper case filenames. Fixes #122.
author phoku@33b003aa-7bff-0310-803a-e67f0ece8222
date Mon, 24 Aug 2009 16:06:30 +0000
parents 90005975cdbb
children a3a044c586ab
comparison
equal deleted inserted replaced
336:16112ef84609 337:f9aca52c7c45
166 } 166 }
167 167
168 std::string VFS::lower(const std::string& str) const { 168 std::string VFS::lower(const std::string& str) const {
169 std::string result; 169 std::string result;
170 result.resize(str.size()); 170 result.resize(str.size());
171 std::transform(str.begin(), str.end(), result.begin(), tolower); 171 bool found_uppercase = false;
172 for(unsigned i=0; i != str.size(); ++i)
173 {
174 result[i] = tolower(str[i]);
175 found_uppercase |= result[i] != str[i];
176 }
177 if( found_uppercase )
178 {
179 FL_WARN(_log, LMsg("Case mismatch: given '") << str
180 << "', FIFE will use '" << result
181 << "' - Please only use lower case filenames to avoid problems with different file systems.");
182 }
172 return result; 183 return result;
173 } 184 }
174 185
175 std::set<std::string> VFS::listFiles(const std::string& pathstr) const { 186 std::set<std::string> VFS::listFiles(const std::string& pathstr) const {
176 std::string lowerpath = lower(pathstr); 187 std::string lowerpath = lower(pathstr);