Commit 9477ed0a authored by hjk's avatar hjk

Introduce and use FileName::exists()

This can use the faster route through QFileInfo::exist now.

Change-Id: Idb41b5d5185d7f02eacba498fb01f483d95e8d57
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 36f94d36
...@@ -144,7 +144,7 @@ bool FileUtils::copyRecursively(const FileName &srcFilePath, const FileName &tgt ...@@ -144,7 +144,7 @@ bool FileUtils::copyRecursively(const FileName &srcFilePath, const FileName &tgt
{ {
QFileInfo srcFileInfo = srcFilePath.toFileInfo(); QFileInfo srcFileInfo = srcFilePath.toFileInfo();
if (srcFileInfo.isDir()) { if (srcFileInfo.isDir()) {
if (!tgtFilePath.toFileInfo().exists()) { if (!tgtFilePath.exists()) {
QDir targetDir(tgtFilePath.toString()); QDir targetDir(tgtFilePath.toString());
targetDir.cdUp(); targetDir.cdUp();
if (!targetDir.mkdir(tgtFilePath.toFileInfo().fileName())) { if (!targetDir.mkdir(tgtFilePath.toFileInfo().fileName())) {
...@@ -551,6 +551,13 @@ QString FileName::toUserOutput() const ...@@ -551,6 +551,13 @@ QString FileName::toUserOutput() const
return QDir::toNativeSeparators(toString()); return QDir::toNativeSeparators(toString());
} }
/// \returns a bool indicating whether a file with this
/// FileName exists.
bool FileName::exists() const
{
return QFileInfo::exists(*this);
}
/// Find the parent directory of a given directory. /// Find the parent directory of a given directory.
/// Returns an empty FileName if the current directory is already /// Returns an empty FileName if the current directory is already
......
...@@ -72,6 +72,7 @@ public: ...@@ -72,6 +72,7 @@ public:
static FileName fromUserInput(const QString &filename); static FileName fromUserInput(const QString &filename);
QString toString() const; QString toString() const;
QString toUserOutput() const; QString toUserOutput() const;
bool exists() const;
FileName parentDir() const; FileName parentDir() const;
......
...@@ -384,7 +384,7 @@ FileName AndroidConfig::androidToolPath() const ...@@ -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. // Java and I've made some progress on it. So if android.exe exists, return that instead.
FileName path = m_sdkLocation; FileName path = m_sdkLocation;
path.appendPath(QLatin1String("tools/android" QTC_HOST_EXE_SUFFIX)); path.appendPath(QLatin1String("tools/android" QTC_HOST_EXE_SUFFIX));
if (path.toFileInfo().exists()) if (path.exists())
return path; return path;
path = m_sdkLocation; path = m_sdkLocation;
return path.appendPath(QLatin1String("tools/android" ANDROID_BAT_SUFFIX)); return path.appendPath(QLatin1String("tools/android" ANDROID_BAT_SUFFIX));
...@@ -1299,7 +1299,7 @@ void AndroidConfigurations::load() ...@@ -1299,7 +1299,7 @@ void AndroidConfigurations::load()
void AndroidConfigurations::updateAndroidDevice() void AndroidConfigurations::updateAndroidDevice()
{ {
DeviceManager * const devMgr = DeviceManager::instance(); 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)); devMgr->addDevice(IDevice::Ptr(new Internal::AndroidDevice));
else if (devMgr->find(Constants::ANDROID_DEVICE_ID)) else if (devMgr->find(Constants::ANDROID_DEVICE_ID))
devMgr->removeDevice(Core::Id(Constants::ANDROID_DEVICE_ID)); devMgr->removeDevice(Core::Id(Constants::ANDROID_DEVICE_ID));
......
...@@ -587,7 +587,7 @@ bool AndroidManager::checkCertificatePassword(const QString &keystorePath, const ...@@ -587,7 +587,7 @@ bool AndroidManager::checkCertificatePassword(const QString &keystorePath, const
bool AndroidManager::checkForQt51Files(Utils::FileName fileName) bool AndroidManager::checkForQt51Files(Utils::FileName fileName)
{ {
fileName.appendPath(QLatin1String("android")).appendPath(QLatin1String("version.xml")); fileName.appendPath(QLatin1String("android")).appendPath(QLatin1String("version.xml"));
if (!fileName.toFileInfo().exists()) if (!fileName.exists())
return false; return false;
QDomDocument dstVersionDoc; QDomDocument dstVersionDoc;
if (!openXmlFile(dstVersionDoc, fileName)) if (!openXmlFile(dstVersionDoc, fileName))
...@@ -684,7 +684,7 @@ bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target) ...@@ -684,7 +684,7 @@ bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target)
AndroidBuildApkStep *buildApkStep AndroidBuildApkStep *buildApkStep
= AndroidGlobal::buildStep<AndroidBuildApkStep>(target->activeBuildConfiguration()); = AndroidGlobal::buildStep<AndroidBuildApkStep>(target->activeBuildConfiguration());
if (!buildApkStep || !buildApkStep->androidPackageSourceDir().appendPath(QLatin1String("gradlew")).toFileInfo().exists()) if (!buildApkStep || !buildApkStep->androidPackageSourceDir().appendPath(QLatin1String("gradlew")).exists())
return false; return false;
GradleProperties localProperties; GradleProperties localProperties;
......
...@@ -256,9 +256,9 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode) ...@@ -256,9 +256,9 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode)
m_ui->gdbWarningLabel->setVisible(false); m_ui->gdbWarningLabel->setVisible(false);
if (m_androidConfig.ndkLocation().isEmpty()) { if (m_androidConfig.ndkLocation().isEmpty()) {
m_ndkState = NotSet; m_ndkState = NotSet;
} else if (!platformPath.appendPath(QLatin1String("platforms")).toFileInfo().exists() } else if (!platformPath.appendPath(QLatin1String("platforms")).exists()
|| !toolChainPath.appendPath(QLatin1String("toolchains")).toFileInfo().exists() || !toolChainPath.appendPath(QLatin1String("toolchains")).exists()
|| !sourcesPath.appendPath(QLatin1String("sources/cxx-stl")).toFileInfo().exists()) { || !sourcesPath.appendPath(QLatin1String("sources/cxx-stl")).exists()) {
m_ndkState = Error; m_ndkState = Error;
m_ndkErrorMessage = tr("\"%1\" does not seem to be an Android NDK top folder.") m_ndkErrorMessage = tr("\"%1\" does not seem to be an Android NDK top folder.")
.arg(m_androidConfig.ndkLocation().toUserOutput()); .arg(m_androidConfig.ndkLocation().toUserOutput());
...@@ -277,7 +277,7 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode) ...@@ -277,7 +277,7 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode)
if (ati.architecture != ProjectExplorer::Abi::ArmArchitecture) if (ati.architecture != ProjectExplorer::Abi::ArmArchitecture)
continue; continue;
Utils::FileName gdbPath = m_androidConfig.gdbPath(ati.architecture, ati.version); Utils::FileName gdbPath = m_androidConfig.gdbPath(ati.architecture, ati.version);
if (gdbPath.toFileInfo().exists()) if (gdbPath.exists())
gdbPaths << gdbPath.toString(); gdbPaths << gdbPath.toString();
} }
...@@ -325,8 +325,7 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode) ...@@ -325,8 +325,7 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode)
} else { } else {
Utils::FileName bin = m_androidConfig.openJDKLocation(); Utils::FileName bin = m_androidConfig.openJDKLocation();
bin.appendPath(QLatin1String("bin/javac" QTC_HOST_EXE_SUFFIX)); bin.appendPath(QLatin1String("bin/javac" QTC_HOST_EXE_SUFFIX));
if (!m_androidConfig.openJDKLocation().toFileInfo().exists() if (!m_androidConfig.openJDKLocation().exists() || !bin.exists())
|| !bin.toFileInfo().exists())
m_javaState = Error; m_javaState = Error;
} }
} }
...@@ -407,15 +406,15 @@ bool AndroidSettingsWidget::sdkLocationIsValid() const ...@@ -407,15 +406,15 @@ bool AndroidSettingsWidget::sdkLocationIsValid() const
Utils::FileName androidExe = m_androidConfig.sdkLocation(); Utils::FileName androidExe = m_androidConfig.sdkLocation();
Utils::FileName androidBat = m_androidConfig.sdkLocation(); Utils::FileName androidBat = m_androidConfig.sdkLocation();
Utils::FileName emulator = m_androidConfig.sdkLocation(); Utils::FileName emulator = m_androidConfig.sdkLocation();
return (androidExe.appendPath(QLatin1String("/tools/android" 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)).toFileInfo().exists()) || androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).exists())
&& emulator.appendPath(QLatin1String("/tools/emulator" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists(); && emulator.appendPath(QLatin1String("/tools/emulator" QTC_HOST_EXE_SUFFIX)).exists();
} }
bool AndroidSettingsWidget::sdkPlatformToolsInstalled() const bool AndroidSettingsWidget::sdkPlatformToolsInstalled() const
{ {
Utils::FileName adb = m_androidConfig.sdkLocation(); 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() void AndroidSettingsWidget::saveSettings()
...@@ -477,7 +476,7 @@ void AndroidSettingsWidget::searchForAnt(const Utils::FileName &location) ...@@ -477,7 +476,7 @@ void AndroidSettingsWidget::searchForAnt(const Utils::FileName &location)
ant.appendPath(QLatin1String("ant.bat")); ant.appendPath(QLatin1String("ant.bat"));
else else
ant.appendPath(QLatin1String("ant")); ant.appendPath(QLatin1String("ant"));
if (ant.toFileInfo().exists()) { if (ant.exists()) {
m_androidConfig.setAntLocation(ant); m_androidConfig.setAntLocation(ant);
m_ui->AntLocationPathChooser->setFileName(ant); m_ui->AntLocationPathChooser->setFileName(ant);
} }
......
...@@ -151,13 +151,13 @@ FileName AndroidToolChain::suggestedGdbServer() const ...@@ -151,13 +151,13 @@ FileName AndroidToolChain::suggestedGdbServer() const
Utils::FileName path = AndroidConfigurations::currentConfig().ndkLocation(); Utils::FileName path = AndroidConfigurations::currentConfig().ndkLocation();
path.appendPath(QString::fromLatin1("prebuilt/android-%1/gdbserver/gdbserver") path.appendPath(QString::fromLatin1("prebuilt/android-%1/gdbserver/gdbserver")
.arg(Abi::toString(targetAbi().architecture()))); .arg(Abi::toString(targetAbi().architecture())));
if (path.toFileInfo().exists()) if (path.exists())
return path; return path;
path = AndroidConfigurations::currentConfig().ndkLocation(); path = AndroidConfigurations::currentConfig().ndkLocation();
path.appendPath(QString::fromLatin1("toolchains/%1-%2/prebuilt/gdbserver") path.appendPath(QString::fromLatin1("toolchains/%1-%2/prebuilt/gdbserver")
.arg(AndroidConfig::toolchainPrefix(targetAbi().architecture())) .arg(AndroidConfig::toolchainPrefix(targetAbi().architecture()))
.arg(m_ndkToolChainVersion)); .arg(m_ndkToolChainVersion));
if (path.toFileInfo().exists()) if (path.exists())
return path; return path;
return Utils::FileName(); return Utils::FileName();
......
...@@ -586,7 +586,7 @@ QString CMakeProject::uiHeaderFile(const QString &uiFile) ...@@ -586,7 +586,7 @@ QString CMakeProject::uiHeaderFile(const QString &uiFile)
while (baseDirectory.isChildOf(project)) { while (baseDirectory.isChildOf(project)) {
Utils::FileName cmakeListsTxt = baseDirectory; Utils::FileName cmakeListsTxt = baseDirectory;
cmakeListsTxt.appendPath(QLatin1String("CMakeLists.txt")); cmakeListsTxt.appendPath(QLatin1String("CMakeLists.txt"));
if (cmakeListsTxt.toFileInfo().exists()) if (cmakeListsTxt.exists())
break; break;
QDir dir(baseDirectory.toString()); QDir dir(baseDirectory.toString());
dir.cdUp(); dir.cdUp();
......
...@@ -298,7 +298,7 @@ void DebuggerItemManager::readLegacyDebuggers(const FileName &file) ...@@ -298,7 +298,7 @@ void DebuggerItemManager::readLegacyDebuggers(const FileName &file)
if (fn == QLatin1String("auto")) if (fn == QLatin1String("auto"))
continue; continue;
FileName command = FileName::fromUserInput(fn); FileName command = FileName::fromUserInput(fn);
if (!command.toFileInfo().exists()) if (!command.exists())
continue; continue;
if (findByCommand(command)) if (findByCommand(command))
continue; continue;
......
...@@ -136,7 +136,7 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi ...@@ -136,7 +136,7 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi
Utils::FileName xcodeInfo = IosConfigurations::developerPath().parentDir() Utils::FileName xcodeInfo = IosConfigurations::developerPath().parentDir()
.appendPath(QLatin1String("Info.plist")); .appendPath(QLatin1String("Info.plist"));
bool buggyLldb = false; bool buggyLldb = false;
if (xcodeInfo.toFileInfo().exists()) { if (xcodeInfo.exists()) {
QSettings settings(xcodeInfo.toString(), QSettings::NativeFormat); QSettings settings(xcodeInfo.toString(), QSettings::NativeFormat);
QStringList version = settings.value(QLatin1String("CFBundleShortVersionString")).toString() QStringList version = settings.value(QLatin1String("CFBundleShortVersionString")).toString()
.split(QLatin1Char('.')); .split(QLatin1Char('.'));
...@@ -147,7 +147,7 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi ...@@ -147,7 +147,7 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi
bundlePath.chop(4); bundlePath.chop(4);
Utils::FileName dsymPath = Utils::FileName::fromString( Utils::FileName dsymPath = Utils::FileName::fromString(
bundlePath.append(QLatin1String(".dSYM"))); bundlePath.append(QLatin1String(".dSYM")));
if (!dsymPath.toFileInfo().exists()) { if (!dsymPath.exists()) {
if (buggyLldb) if (buggyLldb)
TaskHub::addTask(Task::Warning, TaskHub::addTask(Task::Warning,
tr("Debugging with Xcode 5.0.x can be unreliable without a dSYM. " tr("Debugging with Xcode 5.0.x can be unreliable without a dSYM. "
......
...@@ -272,7 +272,7 @@ void IosDeployStep::checkProvisioningProfile() ...@@ -272,7 +272,7 @@ void IosDeployStep::checkProvisioningProfile()
// the file is a signed plist stored in DER format // the file is a signed plist stored in DER format
// we simply search for start and end of the plist instead of decoding the DER payload // we simply search for start and end of the plist instead of decoding the DER payload
if (!provisioningFilePath.toFileInfo().exists()) if (!provisioningFilePath.exists())
return; return;
QFile provisionFile(provisioningFilePath.toString()); QFile provisionFile(provisioningFilePath.toString());
if (!provisionFile.open(QIODevice::ReadOnly)) if (!provisionFile.open(QIODevice::ReadOnly))
......
...@@ -450,7 +450,7 @@ QStringList IosDsymBuildStep::defaultCmdList() const ...@@ -450,7 +450,7 @@ QStringList IosDsymBuildStep::defaultCmdList() const
QString dsymutilCmd = QLatin1String("dsymutil"); QString dsymutilCmd = QLatin1String("dsymutil");
Utils::FileName dsymUtilPath = IosConfigurations::developerPath() Utils::FileName dsymUtilPath = IosConfigurations::developerPath()
.appendPath(QLatin1String("Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil")); .appendPath(QLatin1String("Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil"));
if (dsymUtilPath.toFileInfo().exists()) if (dsymUtilPath.exists())
dsymutilCmd = dsymUtilPath.toUserOutput(); dsymutilCmd = dsymUtilPath.toUserOutput();
IosRunConfiguration *runConf = IosRunConfiguration *runConf =
qobject_cast<IosRunConfiguration *>(target()->activeRunConfiguration()); qobject_cast<IosRunConfiguration *>(target()->activeRunConfiguration());
......
...@@ -738,7 +738,7 @@ QString IosToolHandler::iosSimulatorToolPath() ...@@ -738,7 +738,7 @@ QString IosToolHandler::iosSimulatorToolPath()
Utils::FileName devPath = Internal::IosConfigurations::developerPath(); Utils::FileName devPath = Internal::IosConfigurations::developerPath();
bool version182 = devPath.appendPath(QLatin1String( bool version182 = devPath.appendPath(QLatin1String(
"Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/iPhoneSimulatorRemoteClient.framework")) "Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/iPhoneSimulatorRemoteClient.framework"))
.toFileInfo().exists(); .exists();
QString res = Core::ICore::libexecPath() + QLatin1String("/ios/iossim"); QString res = Core::ICore::libexecPath() + QLatin1String("/ios/iossim");
if (version182) if (version182)
res = res.append(QLatin1String("_1_8_2")); res = res.append(QLatin1String("_1_8_2"));
......
...@@ -159,7 +159,7 @@ void KitManager::restoreKits() ...@@ -159,7 +159,7 @@ void KitManager::restoreKits()
// read all kits from user file // read all kits from user file
KitList userKits; KitList userKits;
FileName userSettingsFile(settingsFileName()); FileName userSettingsFile(settingsFileName());
if (userSettingsFile.toFileInfo().exists()) if (userSettingsFile.exists())
userKits = restoreKits(userSettingsFile); userKits = restoreKits(userSettingsFile);
foreach (Kit *k, userKits.kits) { foreach (Kit *k, userKits.kits) {
if (k->isSdkProvided()) if (k->isSdkProvided())
......
...@@ -883,7 +883,7 @@ bool SessionManager::loadSession(const QString &session) ...@@ -883,7 +883,7 @@ bool SessionManager::loadSession(const QString &session)
// Try loading the file // Try loading the file
FileName fileName = sessionNameToFileName(session); FileName fileName = sessionNameToFileName(session);
PersistentSettingsReader reader; PersistentSettingsReader reader;
if (fileName.toFileInfo().exists()) { if (fileName.exists()) {
if (!reader.load(fileName)) { if (!reader.load(fileName)) {
QMessageBox::warning(ICore::dialogParent(), tr("Error while restoring session"), QMessageBox::warning(ICore::dialogParent(), tr("Error while restoring session"),
tr("Could not restore session %1").arg(fileName.toUserOutput())); tr("Could not restore session %1").arg(fileName.toUserOutput()));
...@@ -919,7 +919,7 @@ bool SessionManager::loadSession(const QString &session) ...@@ -919,7 +919,7 @@ bool SessionManager::loadSession(const QString &session)
d->m_sessionName = session; d->m_sessionName = session;
EditorManager::updateWindowTitles(); EditorManager::updateWindowTitles();
if (fileName.toFileInfo().exists()) { if (fileName.exists()) {
d->m_virginSession = false; d->m_virginSession = false;
ProgressManager::addTask(d->m_future.future(), tr("Loading Session"), ProgressManager::addTask(d->m_future.future(), tr("Loading Session"),
...@@ -1021,7 +1021,7 @@ QStringList SessionManager::projectsForSessionName(const QString &session) ...@@ -1021,7 +1021,7 @@ QStringList SessionManager::projectsForSessionName(const QString &session)
{ {
const FileName fileName = sessionNameToFileName(session); const FileName fileName = sessionNameToFileName(session);
PersistentSettingsReader reader; PersistentSettingsReader reader;
if (fileName.toFileInfo().exists()) { if (fileName.exists()) {
if (!reader.load(fileName)) { if (!reader.load(fileName)) {
qWarning() << "Could not restore session" << fileName.toUserOutput(); qWarning() << "Could not restore session" << fileName.toUserOutput();
return QStringList(); return QStringList();
......
...@@ -752,7 +752,7 @@ SettingsAccessor::IssueInfo SettingsAccessor::findIssues(const QVariantMap &data ...@@ -752,7 +752,7 @@ SettingsAccessor::IssueInfo SettingsAccessor::findIssues(const QVariantMap &data
defaultSettingsPath.appendString(m_userSuffix); defaultSettingsPath.appendString(m_userSuffix);
int version = versionFromMap(data); int version = versionFromMap(data);
if (!path.toFileInfo().exists()) { if (!path.exists()) {
return result; return result;
} else if (data.isEmpty() || version < firstSupportedVersion() || version > currentVersion()) { } else if (data.isEmpty() || version < firstSupportedVersion() || version > currentVersion()) {
result.title = QApplication::translate("Utils::SettingsAccessor", "No Valid Settings Found"); result.title = QApplication::translate("Utils::SettingsAccessor", "No Valid Settings Found");
......
...@@ -475,7 +475,7 @@ void TaskWindow::triggerDefaultHandler(const QModelIndex &index) ...@@ -475,7 +475,7 @@ void TaskWindow::triggerDefaultHandler(const QModelIndex &index)
if (d->m_defaultHandler->canHandle(task)) { if (d->m_defaultHandler->canHandle(task)) {
d->m_defaultHandler->handle(task); d->m_defaultHandler->handle(task);
} else { } else {
if (!task.file.toFileInfo().exists()) if (!task.file.exists())
d->m_model->setFileNotFound(index, true); d->m_model->setFileNotFound(index, true);
} }
} }
......
...@@ -192,7 +192,7 @@ void ToolChainManager::restoreToolChains() ...@@ -192,7 +192,7 @@ void ToolChainManager::restoreToolChains()
// read all tool chains from user file. // read all tool chains from user file.
// Read legacy settings once and keep them around... // Read legacy settings once and keep them around...
FileName fileName = settingsFileName(QLatin1String(TOOLCHAIN_FILENAME)); FileName fileName = settingsFileName(QLatin1String(TOOLCHAIN_FILENAME));
if (!fileName.toFileInfo().exists()) if (!fileName.exists())
fileName = settingsFileName(QLatin1String(LEGACY_TOOLCHAIN_FILENAME)); fileName = settingsFileName(QLatin1String(LEGACY_TOOLCHAIN_FILENAME));
readTcs = restoreFromFile(fileName); readTcs = restoreFromFile(fileName);
......
...@@ -104,7 +104,7 @@ void AndroidPackageInstallationStep::run(QFutureInterface<bool> &fi) ...@@ -104,7 +104,7 @@ void AndroidPackageInstallationStep::run(QFutureInterface<bool> &fi)
QString error; QString error;
foreach (const QString &dir, m_androidDirsToClean) { foreach (const QString &dir, m_androidDirsToClean) {
Utils::FileName androidDir = Utils::FileName::fromString(dir); Utils::FileName androidDir = Utils::FileName::fromString(dir);
if (!dir.isEmpty() && androidDir.toFileInfo().exists()) { if (!dir.isEmpty() && androidDir.exists()) {
emit addOutput(tr("Removing directory %1").arg(dir), MessageOutput); emit addOutput(tr("Removing directory %1").arg(dir), MessageOutput);
if (!Utils::FileUtils::removeRecursively(androidDir, &error)) { if (!Utils::FileUtils::removeRecursively(androidDir, &error)) {
emit addOutput(error, ErrorOutput); emit addOutput(error, ErrorOutput);
......
...@@ -241,7 +241,7 @@ bool BarDescriptorFileNodeManager::createBarDescriptor(ProjectExplorer::Project ...@@ -241,7 +241,7 @@ bool BarDescriptorFileNodeManager::createBarDescriptor(ProjectExplorer::Project
content.replace(QLatin1String("TARGETNAME"), targetName); content.replace(QLatin1String("TARGETNAME"), targetName);
content.replace(QLatin1String("ID"), QLatin1String("com.example.") + projectName); content.replace(QLatin1String("ID"), QLatin1String("com.example.") + projectName);
if (project->projectDirectory().appendPath(QLatin1String("qml")).toFileInfo().exists()) if (project->projectDirectory().appendPath(QLatin1String("qml")).exists())
content.replace(QLatin1String("</qnx>"), content.replace(QLatin1String("</qnx>"),
QLatin1String(" <asset path=\"qml\">qml</asset>\n</qnx>")); QLatin1String(" <asset path=\"qml\">qml</asset>\n</qnx>"));
......
...@@ -130,10 +130,10 @@ void BlackBerryApiLevelConfiguration::ctor() ...@@ -130,10 +130,10 @@ void BlackBerryApiLevelConfiguration::ctor()
QString host = qnxHost().toString(); QString host = qnxHost().toString();
FileName qmake4Path = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(host + QLatin1String("/usr/bin/qmake"))); FileName qmake4Path = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(host + QLatin1String("/usr/bin/qmake")));
FileName qmake5Path = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(host + QLatin1String("/usr/bin/qt5/qmake"))); FileName qmake5Path = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(host + QLatin1String("/usr/bin/qt5/qmake")));
if (qmake4Path.toFileInfo().exists()) if (qmake4Path.exists())
m_qmake4BinaryFile = qmake4Path; m_qmake4BinaryFile = qmake4Path;
if (qmake5Path.toFileInfo().exists()) if (qmake5Path.exists())
m_qmake5BinaryFile = qmake5Path; m_qmake5BinaryFile = qmake5Path;
} }
...@@ -183,8 +183,8 @@ bool BlackBerryApiLevelConfiguration::isValid() const ...@@ -183,8 +183,8 @@ bool BlackBerryApiLevelConfiguration::isValid() const
return QnxBaseConfiguration::isValid() && return QnxBaseConfiguration::isValid() &&
((!m_qmake4BinaryFile.isEmpty() || !m_qmake5BinaryFile.isEmpty()) ((!m_qmake4BinaryFile.isEmpty() || !m_qmake5BinaryFile.isEmpty())
&& (m_autoDetectionSource.isEmpty() || && (m_autoDetectionSource.isEmpty() ||
m_autoDetectionSource.toFileInfo().exists()) m_autoDetectionSource.exists())
&& (!m_sysRoot.isEmpty() && m_sysRoot.toFileInfo().exists())); && (!m_sysRoot.isEmpty() && m_sysRoot.exists()));
} }
...@@ -276,10 +276,10 @@ QStringList BlackBerryApiLevelConfiguration::validationErrors() const ...@@ -276,10 +276,10 @@ QStringList BlackBerryApiLevelConfiguration::validationErrors() const
if (m_qmake4BinaryFile.isEmpty() && m_qmake5BinaryFile.isEmpty()) if (m_qmake4BinaryFile.isEmpty() && m_qmake5BinaryFile.isEmpty())
errorStrings << tr("- No Qt version found."); errorStrings << tr("- No Qt version found.");
if (!m_autoDetectionSource.isEmpty() && !m_autoDetectionSource.toFileInfo().exists()) if (!m_autoDetectionSource.isEmpty() && !m_autoDetectionSource.exists())
errorStrings << tr("- No auto detection source found."); errorStrings << tr("- No auto detection source found.");
if (m_sysRoot.isEmpty() && m_sysRoot.toFileInfo().exists()) if (m_sysRoot.isEmpty() && m_sysRoot.exists())
errorStrings << tr("- No sysroot found."); errorStrings << tr("- No sysroot found.");
......
...@@ -391,7 +391,7 @@ bool BlackBerryDeviceConfigurationWizardConfigPage::isComplete() const ...@@ -391,7 +391,7 @@ bool BlackBerryDeviceConfigurationWizardConfigPage::isComplete() const
bool configurationNameComplete = !m_ui->configurationNameField->text().isEmpty(); bool configurationNameComplete = !m_ui->configurationNameField->text().isEmpty();
Utils::FileName fileName = Utils::FileName::fromString(m_ui->debugTokenCombo->currentText()); Utils::FileName fileName = Utils::FileName::fromString(m_ui->debugTokenCombo->currentText());
bool debugTokenComplete = m_holder.isSimulator || !m_holder.isProductionDevice bool debugTokenComplete = m_holder.isSimulator || !m_holder.isProductionDevice
|| (!fileName.isEmpty() && fileName.toFileInfo().exists()); || (!fileName.isEmpty() && fileName.exists());
return configurationNameComplete && debugTokenComplete; return configurationNameComplete && debugTokenComplete;
} }
......
...@@ -188,10 +188,10 @@ void BlackBerryNDKSettingsWidget::updateConfigurationList() ...@@ -188,10 +188,10 @@ void BlackBerryNDKSettingsWidget::updateConfigurationList()
// TODO: Do the same if qmake, qcc, debugger are no longer detected... // TODO: Do the same if qmake, qcc, debugger are no longer detected...
if (!config->isValid()) { if (!config->isValid()) {
QString toolTip = tr("Invalid target %1:").arg(config->targetName()); QString toolTip = tr("Invalid target %1:").arg(config->targetName());
if (config->isAutoDetected() && !config->autoDetectionSource().toFileInfo().exists()) if (config->isAutoDetected() && !config->autoDetectionSource().exists())
toolTip += QLatin1Char('\n') + tr("- Target no longer installed."); toolTip += QLatin1Char('\n') + tr("- Target no longer installed.");
if (!config->envFile().toFileInfo().exists()) if (!config->envFile().exists())
toolTip += QLatin1Char('\n') + tr("- No NDK environment file found."); toolTip += QLatin1Char('\n') + tr("- No NDK environment file found.");
if (config->qmake4BinaryFile().isEmpty() if (config->qmake4BinaryFile().isEmpty()
......
...@@ -136,7 +136,7 @@ bool QnxBaseConfiguration::isValid() const ...@@ -136,7 +136,7 @@ bool QnxBaseConfiguration::isValid() const
void QnxBaseConfiguration::ctor(const FileName &envScript) void QnxBaseConfiguration::ctor(const FileName &envScript)
{ {
QTC_ASSERT(!envScript.isEmpty() && envScript.toFileInfo().exists(), return); QTC_ASSERT(!envScript.isEmpty() && envScript.exists(), return);
m_envFile = envScript; m_envFile = envScript;
m_qnxEnv = QnxUtils::qnxEnvironmentFromEnvFile(m_envFile.toString()); m_qnxEnv = QnxUtils::qnxEnvironmentFromEnvFile(m_envFile.toString());
foreach (const Utils::EnvironmentItem &item, m_qnxEnv) { foreach (const Utils::EnvironmentItem &item, m_qnxEnv) {
...@@ -151,7 +151,7 @@ void QnxBaseConfiguration::ctor(const FileName &envScript) ...@@ -151,7 +151,7 @@ void QnxBaseConfiguration::ctor(const FileName &envScript)
m_qnxHost.toString() + QLatin1String("/usr/bin/qcc"))); m_qnxHost.toString() + QLatin1String("/usr/bin/qcc")));
FileName armlev7GdbPath = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix( FileName armlev7GdbPath = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(
m_qnxHost.toString() + QLatin1String("/usr/bin/ntoarm-gdb"))); m_qnxHost.toString() + QLatin1String("/usr/bin/ntoarm-gdb")));
if (!armlev7GdbPath.toFileInfo().exists()) { if (!armlev7GdbPath.exists()) {
armlev7GdbPath = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix( armlev7GdbPath = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(
m_qnxHost.toString() + QLatin1String("/usr/bin/ntoarmv7-gdb"))); m_qnxHost.toString() + QLatin1String("/usr/bin/ntoarmv7-gdb")));
} }
...@@ -159,13 +159,13 @@ void QnxBaseConfiguration::ctor(const FileName &envScript) ...@@ -159,13 +159,13 @@ void QnxBaseConfiguration::ctor(const FileName &envScript)
FileName x86GdbPath = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix( FileName x86GdbPath = FileName::fromString(Utils::HostOsInfo::withExecutableSuffix(
m_qnxHost.toString() + QLatin1String("/usr/bin/ntox86-gdb"))); m_qnxHost.toString() + QLatin1String("/usr/bin/ntox86-gdb")));
if (qccPath.toFileInfo().exists()) if (qccPath.exists())
m_qccCompiler = qccPath; m_qccCompiler = qccPath;
if (armlev7GdbPath.toFileInfo().exists()) if (armlev7GdbPath.exists())
m_armlev7Debugger = armlev7GdbPath; m_armlev7Debugger = armlev7GdbPath;
if (x86GdbPath.toFileInfo().exists()) if (x86GdbPath.exists())
m_x86Debugger = x86GdbPath; m_x86Debugger = x86GdbPath;
} }
......
...@@ -181,7 +181,7 @@ void QtVersionManager::triggerQtVersionRestore() ...@@ -181,7 +181,7 @@ void QtVersionManager::triggerQtVersionRestore()
saveQtVersions(); saveQtVersions();
const FileName configFileName = globalSettingsFileName(); const FileName configFileName = globalSettingsFileName();
if (configFileName.toFileInfo().exists()) { if (configFileName.exists()) {
m_configFileWatcher = new FileSystemWatcher(m_instance); m_configFileWatcher = new FileSystemWatcher(m_instance);
connect(m_configFileWatcher, SIGNAL(fileChanged(QString)), connect(m_configFileWatcher, SIGNAL(fileChanged(QString)),
m_fileWatcherTimer, SLOT(start())); m_fileWatcherTimer, SLOT(start()));
...@@ -231,7 +231,7 @@ static bool restoreQtVersions() ...@@ -231,7 +231,7 @@ static bool restoreQtVersions()
FileName filename = settingsFileName(QLatin1String(QTVERSION_FILENAME)); FileName filename = settingsFileName(QLatin1String(QTVERSION_FILENAME));
// Read Qt Creator 2.5 qtversions.xml once: // Read Qt Creator 2.5 qtversions.xml once:
if (!filename.toFileInfo().exists()) if (!filename.exists())
filename = settingsFileName(QLatin1String(QTVERSION_LEGACY_FILENAME)); filename = settingsFileName(QLatin1String(QTVERSION_LEGACY_FILENAME));
if (!reader.load(filename)) if (!reader.load(filename))
return false; return false;
......
...@@ -102,7 +102,7 @@ QVariantMap Operation::load(const QString &file) ...@@ -102,7 +102,7 @@ QVariantMap Operation::load(const QString &file)
// Read values from original file: // Read values from original file:
Utils::FileName path = Settings::instance()->getPath(file); Utils::FileName path = Settings::instance()->getPath(file);
if (path.toFileInfo().exists()) { if (path.exists()) {
Utils::PersistentSettingsReader reader; Utils::PersistentSettingsReader reader;
if (!reader.load(path)) if (!reader.load(path))
return QVariantMap(); return QVariantMap();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment