Remove unneeded checks for validity of mime types

mimeTypeForFile(...) is documented to never return an invalid mime type
(it will fall back to binary if everything else fails), so remove
unneeded checks.

This also removes fallback code that used text/plain in case of invalid
mime type, which is probably a relict from the old mime implementation.

Change-Id: I88ed41fa3b81704f110f9f481b0f01424a487cbb
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2018-06-21 15:11:39 +02:00
parent e00218b997
commit a8c5af56a9
8 changed files with 59 additions and 88 deletions

View File

@@ -51,8 +51,6 @@ ProjectFile::Kind ProjectFile::classify(const QString &filePath)
return AmbiguousHeader;
const Utils::MimeType mimeType = Utils::mimeTypeForFile(filePath);
if (!mimeType.isValid())
return Unsupported;
const QString mt = mimeType.name();
if (mt == QLatin1String(CppTools::Constants::C_SOURCE_MIMETYPE))
return CSource;