forked from qt-creator/qt-creator
Introduce and use FileName::exists()
This can use the faster route through QFileInfo::exist now. Change-Id: Idb41b5d5185d7f02eacba498fb01f483d95e8d57 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com> Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -384,7 +384,7 @@ FileName AndroidConfig::androidToolPath() const
|
||||
// Java and I've made some progress on it. So if android.exe exists, return that instead.
|
||||
FileName path = m_sdkLocation;
|
||||
path.appendPath(QLatin1String("tools/android" QTC_HOST_EXE_SUFFIX));
|
||||
if (path.toFileInfo().exists())
|
||||
if (path.exists())
|
||||
return path;
|
||||
path = m_sdkLocation;
|
||||
return path.appendPath(QLatin1String("tools/android" ANDROID_BAT_SUFFIX));
|
||||
@@ -1299,7 +1299,7 @@ void AndroidConfigurations::load()
|
||||
void AndroidConfigurations::updateAndroidDevice()
|
||||
{
|
||||
DeviceManager * const devMgr = DeviceManager::instance();
|
||||
if (m_instance->m_config.adbToolPath().toFileInfo().exists())
|
||||
if (m_instance->m_config.adbToolPath().exists())
|
||||
devMgr->addDevice(IDevice::Ptr(new Internal::AndroidDevice));
|
||||
else if (devMgr->find(Constants::ANDROID_DEVICE_ID))
|
||||
devMgr->removeDevice(Core::Id(Constants::ANDROID_DEVICE_ID));
|
||||
|
||||
@@ -587,7 +587,7 @@ bool AndroidManager::checkCertificatePassword(const QString &keystorePath, const
|
||||
bool AndroidManager::checkForQt51Files(Utils::FileName fileName)
|
||||
{
|
||||
fileName.appendPath(QLatin1String("android")).appendPath(QLatin1String("version.xml"));
|
||||
if (!fileName.toFileInfo().exists())
|
||||
if (!fileName.exists())
|
||||
return false;
|
||||
QDomDocument dstVersionDoc;
|
||||
if (!openXmlFile(dstVersionDoc, fileName))
|
||||
@@ -684,7 +684,7 @@ bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target)
|
||||
AndroidBuildApkStep *buildApkStep
|
||||
= AndroidGlobal::buildStep<AndroidBuildApkStep>(target->activeBuildConfiguration());
|
||||
|
||||
if (!buildApkStep || !buildApkStep->androidPackageSourceDir().appendPath(QLatin1String("gradlew")).toFileInfo().exists())
|
||||
if (!buildApkStep || !buildApkStep->androidPackageSourceDir().appendPath(QLatin1String("gradlew")).exists())
|
||||
return false;
|
||||
|
||||
GradleProperties localProperties;
|
||||
|
||||
@@ -256,9 +256,9 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode)
|
||||
m_ui->gdbWarningLabel->setVisible(false);
|
||||
if (m_androidConfig.ndkLocation().isEmpty()) {
|
||||
m_ndkState = NotSet;
|
||||
} else if (!platformPath.appendPath(QLatin1String("platforms")).toFileInfo().exists()
|
||||
|| !toolChainPath.appendPath(QLatin1String("toolchains")).toFileInfo().exists()
|
||||
|| !sourcesPath.appendPath(QLatin1String("sources/cxx-stl")).toFileInfo().exists()) {
|
||||
} else if (!platformPath.appendPath(QLatin1String("platforms")).exists()
|
||||
|| !toolChainPath.appendPath(QLatin1String("toolchains")).exists()
|
||||
|| !sourcesPath.appendPath(QLatin1String("sources/cxx-stl")).exists()) {
|
||||
m_ndkState = Error;
|
||||
m_ndkErrorMessage = tr("\"%1\" does not seem to be an Android NDK top folder.")
|
||||
.arg(m_androidConfig.ndkLocation().toUserOutput());
|
||||
@@ -277,7 +277,7 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode)
|
||||
if (ati.architecture != ProjectExplorer::Abi::ArmArchitecture)
|
||||
continue;
|
||||
Utils::FileName gdbPath = m_androidConfig.gdbPath(ati.architecture, ati.version);
|
||||
if (gdbPath.toFileInfo().exists())
|
||||
if (gdbPath.exists())
|
||||
gdbPaths << gdbPath.toString();
|
||||
}
|
||||
|
||||
@@ -325,8 +325,7 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode)
|
||||
} else {
|
||||
Utils::FileName bin = m_androidConfig.openJDKLocation();
|
||||
bin.appendPath(QLatin1String("bin/javac" QTC_HOST_EXE_SUFFIX));
|
||||
if (!m_androidConfig.openJDKLocation().toFileInfo().exists()
|
||||
|| !bin.toFileInfo().exists())
|
||||
if (!m_androidConfig.openJDKLocation().exists() || !bin.exists())
|
||||
m_javaState = Error;
|
||||
}
|
||||
}
|
||||
@@ -407,15 +406,15 @@ bool AndroidSettingsWidget::sdkLocationIsValid() const
|
||||
Utils::FileName androidExe = m_androidConfig.sdkLocation();
|
||||
Utils::FileName androidBat = m_androidConfig.sdkLocation();
|
||||
Utils::FileName emulator = m_androidConfig.sdkLocation();
|
||||
return (androidExe.appendPath(QLatin1String("/tools/android" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()
|
||||
|| androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).toFileInfo().exists())
|
||||
&& emulator.appendPath(QLatin1String("/tools/emulator" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists();
|
||||
return (androidExe.appendPath(QLatin1String("/tools/android" QTC_HOST_EXE_SUFFIX)).exists()
|
||||
|| androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).exists())
|
||||
&& emulator.appendPath(QLatin1String("/tools/emulator" QTC_HOST_EXE_SUFFIX)).exists();
|
||||
}
|
||||
|
||||
bool AndroidSettingsWidget::sdkPlatformToolsInstalled() const
|
||||
{
|
||||
Utils::FileName adb = m_androidConfig.sdkLocation();
|
||||
return adb.appendPath(QLatin1String("platform-tools/adb" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists();
|
||||
return adb.appendPath(QLatin1String("platform-tools/adb" QTC_HOST_EXE_SUFFIX)).exists();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::saveSettings()
|
||||
@@ -477,7 +476,7 @@ void AndroidSettingsWidget::searchForAnt(const Utils::FileName &location)
|
||||
ant.appendPath(QLatin1String("ant.bat"));
|
||||
else
|
||||
ant.appendPath(QLatin1String("ant"));
|
||||
if (ant.toFileInfo().exists()) {
|
||||
if (ant.exists()) {
|
||||
m_androidConfig.setAntLocation(ant);
|
||||
m_ui->AntLocationPathChooser->setFileName(ant);
|
||||
}
|
||||
|
||||
@@ -151,13 +151,13 @@ FileName AndroidToolChain::suggestedGdbServer() const
|
||||
Utils::FileName path = AndroidConfigurations::currentConfig().ndkLocation();
|
||||
path.appendPath(QString::fromLatin1("prebuilt/android-%1/gdbserver/gdbserver")
|
||||
.arg(Abi::toString(targetAbi().architecture())));
|
||||
if (path.toFileInfo().exists())
|
||||
if (path.exists())
|
||||
return path;
|
||||
path = AndroidConfigurations::currentConfig().ndkLocation();
|
||||
path.appendPath(QString::fromLatin1("toolchains/%1-%2/prebuilt/gdbserver")
|
||||
.arg(AndroidConfig::toolchainPrefix(targetAbi().architecture()))
|
||||
.arg(m_ndkToolChainVersion));
|
||||
if (path.toFileInfo().exists())
|
||||
if (path.exists())
|
||||
return path;
|
||||
|
||||
return Utils::FileName();
|
||||
|
||||
Reference in New Issue
Block a user