Fix androiddeployqt copying build directory

When project's Android package source directory is set to the
project level (instead of project/android) androiddeployqt keeps
copying the build directory under itself infinitely.

Add check to copyFiles:
-If android source dir is the same as project source dir
-And if current directory copied is in build directory path

Pick-to: 6.5 6.8 6.9 6.10
Fixes: QTBUG-126743
Change-Id: If45766152c6cbf9e2ee916baa5a15282d3fedaf2
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
Jani Korteniemi 2025-05-16 10:17:22 +03:00
parent 270b219410
commit 3047d6a8a1

View File

@ -1498,6 +1498,10 @@ bool copyFiles(const QDir &sourceDirectory, const QDir &destinationDirectory, co
for (const QFileInfo &entry : entries) {
if (entry.isDir()) {
QDir dir(entry.absoluteFilePath());
const bool destinationInCopyDir = destinationDirectory.absolutePath().startsWith(dir.absolutePath());
if (sourceDirectory == options.androidSourceDirectory && destinationInCopyDir)
continue;
if (!destinationDirectory.mkpath(dir.dirName())) {
fprintf(stderr, "Cannot make directory %s in %s\n", qPrintable(dir.dirName()), qPrintable(destinationDirectory.path()));
return false;