CMake: Use FilePath::ensureExistingFile in file API

Change-Id: I38c2e97711bbc1c72c51eeb59429572ea7931e4d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-06-29 09:40:56 +02:00
parent 1e1c556bc8
commit d857e17b13

View File

@@ -839,14 +839,8 @@ bool FileApiParser::setupCMakeFileApi(const FilePath &buildDirectory, Utils::Fil
bool failedBefore = false; bool failedBefore = false;
for (const FilePath &filePath : cmakeQueryFilePaths(buildDirectory)) { for (const FilePath &filePath : cmakeQueryFilePaths(buildDirectory)) {
QTC_CHECK(!filePath.needsDevice()); const bool success = filePath.ensureExistingFile();
QFile f(filePath.path()); if (!success && !failedBefore) {
if (!f.exists()) {
f.open(QFile::WriteOnly);
f.close();
}
if (!f.exists() && !failedBefore) {
failedBefore = true; failedBefore = true;
reportFileApiSetupFailure(); reportFileApiSetupFailure();
} }