Android: Fix post-build opening of package location for Qt 6.8

When building an Android package for Qt > 6.8, Qt Creator sets the env
variable QT_USE_TARGET_ANDROID_BUILD_DIR. This alters the name of the
resulting package compared to a Qt 6.7 package, which prevents the post-
build opening of package location.

This change adds a check whether the package file exists and a fallback
to its parent directory for the case it does not.

Fixes: QTCREATORBUG-22627
Change-Id: I35b63fa0a7cf19b78f460dfdb7ec35f7ec370d48
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Alessandro Portale
2024-08-23 16:59:25 +02:00
parent fca315aa76
commit 6b69a2069a

View File

@@ -603,7 +603,16 @@ void AndroidBuildApkStep::setupOutputFormatter(OutputFormatter *formatter)
void AndroidBuildApkStep::showInGraphicalShell() void AndroidBuildApkStep::showInGraphicalShell()
{ {
Core::FileUtils::showInGraphicalShell(Core::ICore::dialogParent(), m_packagePath); FilePath packagePath = m_packagePath;
if (!packagePath.exists()) { // File name might be incorrect. See: QTCREATORBUG-22627
packagePath = packagePath.parentDir();
if (!packagePath.exists()) {
qCDebug(buildapkstepLog).noquote()
<< "Could not open package location: " << packagePath;
return;
}
}
Core::FileUtils::showInGraphicalShell(Core::ICore::dialogParent(), packagePath);
} }
QWidget *AndroidBuildApkStep::createConfigWidget() QWidget *AndroidBuildApkStep::createConfigWidget()