diff options
author | Assam Boudjelthia <assam.boudjelthia@qt.io> | 2022-04-15 15:44:13 +0300 |
---|---|---|
committer | Assam Boudjelthia <assam.boudjelthia@qt.io> | 2022-04-21 11:52:35 +0300 |
commit | 7fbf01bf07e4a3aefe18bfe63c1aacf0b6c0685c (patch) | |
tree | 7147684fb53040babaf61d396cc82d9c8698f568 /src/tools | |
parent | f10d0c781e6f605684de32d58dbffbd05a4b99a5 (diff) |
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>
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/androiddeployqt/main.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index 6067b0472f..f42e3bd4a9 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -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) |