rwilson, there is an easier way to get the real filename in windows. Check this C function:
<verbatim>
   BOOL GetRealFilename( const char * szFilename, char * szRealFilename )
   {
      char szTempFilename[ MAX_PATH ];
      if( GetShortPathName( szFilename, szTempFilename, MAX_PATH ) )
         if( GetLongPathName( szTempFilename, szRealFilename, MAX_PATH ) )
            return TRUE;
      return FALSE;
   }
</verbatim>
Also, it allows to check the existance of a file, since it returns FALSE if the file doesn't exist.

But that doesn't fix the problem at 100%. You could rename a file in your working directory, changing only case, and get again in a trouble. So, the check have to be done in the repository.

The drh fix solves the most cases, although it doesn't deal with non ascii chars. Thanks, however!