Android: remove the old copy of gradle.properties after reading it
The file is going to be remove anyways in the next build, so just delete it once we're done with it, this also makes the build folder doesn't have files that are not needed. Pick-to: 6.2 6.3 5.15 Change-Id: I948f028e9151b38a3ccc1ec628239ac91397e0d0 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
parent
f10d0c781e
commit
7fbf01bf07
@ -2602,15 +2602,16 @@ static GradleProperties readGradleProperties(const QString &path)
|
||||
|
||||
static bool mergeGradleProperties(const QString &path, GradleProperties properties)
|
||||
{
|
||||
QFile::remove(path + u'~');
|
||||
QFile::rename(path, path + u'~');
|
||||
const QString oldPathStr = path + u'~';
|
||||
QFile::remove(oldPathStr);
|
||||
QFile::rename(path, oldPathStr);
|
||||
QFile file(path);
|
||||
if (!file.open(QIODevice::Truncate | QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
fprintf(stderr, "Can't open file: %s for writing\n", qPrintable(file.fileName()));
|
||||
return false;
|
||||
}
|
||||
|
||||
QFile oldFile(path + u'~');
|
||||
QFile oldFile(oldPathStr);
|
||||
if (oldFile.open(QIODevice::ReadOnly)) {
|
||||
while (!oldFile.atEnd()) {
|
||||
QByteArray line(oldFile.readLine());
|
||||
@ -2626,6 +2627,7 @@ static bool mergeGradleProperties(const QString &path, GradleProperties properti
|
||||
file.write(line);
|
||||
}
|
||||
oldFile.close();
|
||||
QFile::remove(oldPathStr);
|
||||
}
|
||||
|
||||
for (GradleProperties::const_iterator it = properties.begin(); it != properties.end(); ++it)
|
||||
|
Loading…
x
Reference in New Issue
Block a user