// low-level filesystem wrapper FILE *CFileSystem_Stdio::FS_fopen(const char *filename, const char *options, bool bFromCache) { FILE *tst = fopen(filename, options); #ifndef _WIN32 if (!tst && !Q_strchr(options, 'w') && !Q_strchr(options, '+')) { const char *file = findFileInDirCaseInsensitive(filename); tst = fopen(filename, options); } #endif // _WIN32 return tst; }
int CFileSystem_Stdio::FS_stat(const char *path, struct _stat *buf) { int rt = _stat(path, buf); #ifndef _WIN32 if (rt == -1) { const char *file = findFileInDirCaseInsensitive(path); if (file) { rt = _stat(file, buf); } } #endif // _WIN32 return rt; }
void CVCProjConvert::FindFileCaseInsensitive( char *fileName, int fileNameSize ) { char filePath[ MAX_PATH ]; Q_snprintf( filePath, sizeof(filePath), "%s/%s", m_BaseDir.String(), fileName ); struct _stat buf; if ( _stat( filePath, &buf ) == 0) { return; // found the filename directly } #ifdef _LINUX const char *realName = findFileInDirCaseInsensitive( filePath ); if ( realName ) { Q_strncpy( fileName, realName+strlen(m_BaseDir.String())+1, fileNameSize ); } #endif }