ProjectManager: Centralize "File not found handling"

That's the only error that was ever checked for, in all nine
project manager. In the hypothetical case that we'll need something
else than the name of a file to identify a "project file", we'd
probably need to touch the signature anyway. Until then, remove
the duplication.

Change-Id: Iba00b8f71309a908e2d29c0a58c50b685eca0cae
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
hjk
2017-02-28 16:07:53 +01:00
parent 3490c5751d
commit 50d1690854
18 changed files with 24 additions and 94 deletions

View File

@@ -156,17 +156,9 @@ void CMakeManager::rescanProject(Project *project)
cmakeProject->runCMake(); // by my experience: every rescan run requires cmake run too
}
Project *CMakeManager::openProject(const QString &fileName, QString *errorString)
Project *CMakeManager::openProject(const QString &fileName)
{
Utils::FileName file = Utils::FileName::fromString(fileName);
if (!file.toFileInfo().isFile()) {
if (errorString)
*errorString = tr("Failed opening project \"%1\": Project is not a file")
.arg(file.toUserOutput());
return 0;
}
return new CMakeProject(file);
return new CMakeProject(Utils::FileName::fromString(fileName));
}
QString CMakeManager::mimeType() const