Mercurial > fife-parpg
changeset 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 | 16112ef84609 |
children | d266506ff4f9 |
files | engine/core/vfs/vfs.cpp engine/core/vfs/vfs.h |
diffstat | 2 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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; }
--- 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: