From 6b69a2069a597bf76268039bf8c897078780da92 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Fri, 23 Aug 2024 16:59:25 +0200 Subject: [PATCH] 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 --- src/plugins/android/androidbuildapkstep.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/android/androidbuildapkstep.cpp b/src/plugins/android/androidbuildapkstep.cpp index cc3287b61e0..8a21d17b84f 100644 --- a/src/plugins/android/androidbuildapkstep.cpp +++ b/src/plugins/android/androidbuildapkstep.cpp @@ -603,7 +603,16 @@ void AndroidBuildApkStep::setupOutputFormatter(OutputFormatter *formatter) 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()