# HG changeset patch # User phoku@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1251129990 0 # Node ID f9aca52c7c4562680697a6144eb83eec6fcf2110 # Parent 16112ef846096d92f8ccbb71eb99b5ed744fc874 VFS: * Emit warning for upper case filenames. Fixes #122. diff -r 16112ef84609 -r f9aca52c7c45 engine/core/vfs/vfs.cpp --- a/engine/core/vfs/vfs.cpp Mon Aug 24 15:34:23 2009 +0000 +++ b/engine/core/vfs/vfs.cpp Mon Aug 24 16:06:30 2009 +0000 @@ -168,7 +168,18 @@ std::string VFS::lower(const std::string& str) const { std::string result; result.resize(str.size()); - std::transform(str.begin(), str.end(), result.begin(), tolower); + bool found_uppercase = false; + for(unsigned i=0; i != str.size(); ++i) + { + result[i] = tolower(str[i]); + found_uppercase |= result[i] != str[i]; + } + if( found_uppercase ) + { + FL_WARN(_log, LMsg("Case mismatch: given '") << str + << "', FIFE will use '" << result + << "' - Please only use lower case filenames to avoid problems with different file systems."); + } return result; } diff -r 16112ef84609 -r f9aca52c7c45 engine/core/vfs/vfs.h --- a/engine/core/vfs/vfs.h Mon Aug 24 15:34:23 2009 +0000 +++ b/engine/core/vfs/vfs.h Mon Aug 24 16:06:30 2009 +0000 @@ -48,6 +48,10 @@ * @note The VFS searches for a provider in the order they are added to the * VFS. Since the VFSHostSystem is added first, this implies, that host filesystem * files will override whatever might be in other VFS Sources (e.g. the DAT files) + * + * @note All filenames have to be @b lowercase. The VFS will convert them to lowercase + * and emit a warning. This is done to avoid problems with filesystems which are not + * case sensitive. */ class VFS { public: