bool FileSystem::fileExists(const QString& filename) { #ifdef Q_OS_WIN if (isLnkFile(filename)) { // Use a native check. return fileExistsWin(filename); } #endif QFileInfo file(filename); return file.exists(); }
bool FileSystem::fileExists(const QString& filename, const QFileInfo& fileInfo) { #ifdef Q_OS_WIN if (isLnkFile(filename)) { // Use a native check. return fileExistsWin(filename); } #endif bool re = fileInfo.exists(); // if the filename is different from the filename in fileInfo, the fileInfo is // not valid. There needs to be one initialised here. Otherwise the incoming // fileInfo is re-used. if( fileInfo.filePath() != filename ) { QFileInfo myFI(filename); re = myFI.exists(); } return re; }