diff --git a/src/plugins/android/androiddeployqtstep.cpp b/src/plugins/android/androiddeployqtstep.cpp index 0d33bce4c0f..f032f84986c 100644 --- a/src/plugins/android/androiddeployqtstep.cpp +++ b/src/plugins/android/androiddeployqtstep.cpp @@ -44,17 +44,13 @@ #include #include #include -#include using namespace ProjectExplorer; using namespace Utils; -namespace Android { -namespace Internal { +namespace Android::Internal { -namespace { static Q_LOGGING_CATEGORY(deployStepLog, "qtc.android.build.androiddeployqtstep", QtWarningMsg) -} const QLatin1String UninstallPreviousPackageKey("UninstallPreviousPackage"); const QLatin1String InstallFailedInconsistentCertificatesString("INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES"); @@ -435,18 +431,17 @@ bool AndroidDeployQtStep::runImpl() // Note that values are not necessarily unique, e.g. app_process is looked up in several // directories - for (auto itr = m_filesToPull.constBegin(); itr != m_filesToPull.constEnd(); ++itr) { - QFile::remove(itr.value()); - } + for (auto itr = m_filesToPull.constBegin(); itr != m_filesToPull.constEnd(); ++itr) + itr.value().removeFile(); for (auto itr = m_filesToPull.constBegin(); itr != m_filesToPull.constEnd(); ++itr) { runCommand({m_adbPath, AndroidDeviceInfo::adbSelector(m_serialNumber) - << "pull" << itr.key() << itr.value()}); - if (!QFileInfo::exists(itr.value())) { + << "pull" << itr.key() << itr.value().nativePath()}); + if (!itr.value().exists()) { const QString error = Tr::tr("Package deploy: Failed to pull \"%1\" to \"%2\".") .arg(itr.key()) - .arg(itr.value()); + .arg(itr.value().nativePath()); reportWarningOrError(error, Task::Error); } } @@ -457,29 +452,26 @@ bool AndroidDeployQtStep::runImpl() void AndroidDeployQtStep::gatherFilesToPull() { m_filesToPull.clear(); - QString buildDir = AndroidManager::buildDirectory(target()).toString(); - if (!buildDir.endsWith("/")) { - buildDir += "/"; - } + const FilePath buildDir = AndroidManager::buildDirectory(target()); if (!m_deviceInfo.isValid()) return; QString linkerName("linker"); QString libDirName("lib"); - auto preferreABI = AndroidManager::apkDevicePreferredAbi(target()); - if (preferreABI == ProjectExplorer::Constants::ANDROID_ABI_ARM64_V8A - || preferreABI == ProjectExplorer::Constants::ANDROID_ABI_X86_64) { - m_filesToPull["/system/bin/app_process64"] = buildDir + "app_process"; + const QString preferredAbi = AndroidManager::apkDevicePreferredAbi(target()); + if (preferredAbi == ProjectExplorer::Constants::ANDROID_ABI_ARM64_V8A + || preferredAbi == ProjectExplorer::Constants::ANDROID_ABI_X86_64) { + m_filesToPull["/system/bin/app_process64"] = buildDir / "app_process"; libDirName = "lib64"; linkerName = "linker64"; } else { - m_filesToPull["/system/bin/app_process32"] = buildDir + "app_process"; - m_filesToPull["/system/bin/app_process"] = buildDir + "app_process"; + m_filesToPull["/system/bin/app_process32"] = buildDir / "app_process"; + m_filesToPull["/system/bin/app_process"] = buildDir / "app_process"; } - m_filesToPull["/system/bin/" + linkerName] = buildDir + linkerName; - m_filesToPull["/system/" + libDirName + "/libc.so"] = buildDir + "libc.so"; + m_filesToPull["/system/bin/" + linkerName] = buildDir / linkerName; + m_filesToPull["/system/" + libDirName + "/libc.so"] = buildDir / "libc.so"; for (auto itr = m_filesToPull.constBegin(); itr != m_filesToPull.constEnd(); ++itr) qCDebug(deployStepLog).noquote() << "Pulling file from device:" << itr.key() @@ -587,5 +579,4 @@ AndroidDeployQtStepFactory::AndroidDeployQtStepFactory() setDisplayName(Tr::tr("Deploy to Android device")); } -} // Internal -} // Android +} // Android::Internal diff --git a/src/plugins/android/androiddeployqtstep.h b/src/plugins/android/androiddeployqtstep.h index 2f172615951..a1bcd1b7d75 100644 --- a/src/plugins/android/androiddeployqtstep.h +++ b/src/plugins/android/androiddeployqtstep.h @@ -16,8 +16,7 @@ namespace Utils { class QtcProcess; } -namespace Android { -namespace Internal { +namespace Android::Internal { class AndroidDeployQtStepFactory : public ProjectExplorer::BuildStepFactory { @@ -78,7 +77,7 @@ private: QString m_serialNumber; QString m_avdName; Utils::FilePath m_apkPath; - QMap m_filesToPull; + QMap m_filesToPull; QStringList m_androidABIs; Utils::BoolAspect *m_uninstallPreviousPackage = nullptr; @@ -96,5 +95,4 @@ private: Utils::FutureSynchronizer m_synchronizer; }; -} -} // namespace Android +} // Android::Internal