forked from qt-creator/qt-creator
Use QFileInfo::exist(f) instead of QFileInfo(f).exists() if possible
Faster. Change-Id: I91aa67462e11ff3258600d7f158de79942d0dc81 Reviewed-by: Marc Reilly <marc.reilly@gmail.com> Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -142,7 +142,7 @@ void SshKeyCreationDialog::saveKeys()
|
||||
|
||||
bool SshKeyCreationDialog::userForbidsOverwriting()
|
||||
{
|
||||
if (!QFileInfo(privateKeyFilePath()).exists() && !QFileInfo(publicKeyFilePath()).exists())
|
||||
if (!QFileInfo::exists(privateKeyFilePath()) && !QFileInfo::exists(publicKeyFilePath()))
|
||||
return false;
|
||||
const QMessageBox::StandardButton reply = QMessageBox::question(this, tr("File Exists"),
|
||||
tr("There already is a file of that name. Do you want to overwrite it?"),
|
||||
|
||||
@@ -269,7 +269,7 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments,
|
||||
log->append(newline);
|
||||
|
||||
const FileName makeFullPath = arguments.environment.searchInPath(arguments.makeCommand);
|
||||
if (QFileInfo(arguments.directory + QLatin1String("/Makefile")).exists()) {
|
||||
if (QFileInfo::exists(arguments.directory + QLatin1String("/Makefile"))) {
|
||||
if (makeFullPath.isEmpty()) {
|
||||
*errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary",
|
||||
"%1 not found in PATH\n").arg(arguments.makeCommand);
|
||||
|
||||
@@ -1213,7 +1213,7 @@ static FileName javaHomeForJavac(const FileName &location)
|
||||
while (tries > 0) {
|
||||
QDir dir = fileInfo.dir();
|
||||
dir.cdUp();
|
||||
if (QFileInfo(dir.filePath(QLatin1String("lib/tools.jar"))).exists())
|
||||
if (QFileInfo::exists(dir.filePath(QLatin1String("lib/tools.jar"))))
|
||||
return FileName::fromString(dir.path());
|
||||
if (fileInfo.isSymLink())
|
||||
fileInfo.setFile(fileInfo.symLinkTarget());
|
||||
@@ -1252,7 +1252,7 @@ void AndroidConfigurations::load()
|
||||
}
|
||||
} else if (HostOsInfo::isMacHost()) {
|
||||
QString javaHome = QLatin1String("/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home");
|
||||
if (QFileInfo(javaHome).exists())
|
||||
if (QFileInfo::exists(javaHome))
|
||||
m_config.setOpenJDKLocation(Utils::FileName::fromString(javaHome));
|
||||
} else if (HostOsInfo::isWindowsHost()) {
|
||||
QSettings settings(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Javasoft\\Java Development Kit"), QSettings::NativeFormat);
|
||||
@@ -1275,7 +1275,7 @@ void AndroidConfigurations::load()
|
||||
settings.beginGroup(version);
|
||||
QString tmpJavaHome = settings.value(QLatin1String("JavaHome")).toString();
|
||||
settings.endGroup();
|
||||
if (!QFileInfo(tmpJavaHome).exists())
|
||||
if (!QFileInfo::exists(tmpJavaHome))
|
||||
continue;
|
||||
|
||||
major = tmpMajor;
|
||||
|
||||
@@ -1259,7 +1259,7 @@ QIcon AndroidManifestEditorWidget::icon(const QString &baseDir, IconDPI dpi)
|
||||
|
||||
void AndroidManifestEditorWidget::copyIcon(IconDPI dpi, const QString &baseDir, const QString &filePath)
|
||||
{
|
||||
if (!QFileInfo(filePath).exists())
|
||||
if (!QFileInfo::exists(filePath))
|
||||
return;
|
||||
|
||||
const QString targetPath = iconPath(baseDir, dpi);
|
||||
|
||||
@@ -122,7 +122,7 @@ void AndroidToolChain::addToEnvironment(Environment &env) const
|
||||
env.set(QLatin1String("ANDROID_NDK_TOOLS_PREFIX"), AndroidConfig::toolsPrefix(targetAbi().architecture()));
|
||||
env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_VERSION"), m_ndkToolChainVersion);
|
||||
QString javaHome = AndroidConfigurations::currentConfig().openJDKLocation().toString();
|
||||
if (!javaHome.isEmpty() && QFileInfo(javaHome).exists())
|
||||
if (!javaHome.isEmpty() && QFileInfo::exists(javaHome))
|
||||
env.set(QLatin1String("JAVA_HOME"), javaHome);
|
||||
env.set(QLatin1String("ANDROID_HOME"), AndroidConfigurations::currentConfig().sdkLocation().toString());
|
||||
env.set(QLatin1String("ANDROID_SDK_ROOT"), AndroidConfigurations::currentConfig().sdkLocation().toString());
|
||||
|
||||
@@ -173,9 +173,8 @@ void AutoreconfStep::run(QFutureInterface<bool> &interface)
|
||||
|
||||
// Check whether we need to run autoreconf
|
||||
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
||||
const QFileInfo configureInfo(projectDir + QLatin1String("/configure"));
|
||||
|
||||
if (!configureInfo.exists())
|
||||
if (!QFileInfo::exists(projectDir + QLatin1String("/configure")))
|
||||
m_runAutoreconf = true;
|
||||
|
||||
if (!m_runAutoreconf) {
|
||||
|
||||
@@ -219,7 +219,7 @@ CMakeEditorWidget::Link CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
if (fi.isDir()) {
|
||||
QDir subDir(fi.absoluteFilePath());
|
||||
QString subProject = subDir.filePath(QLatin1String("CMakeLists.txt"));
|
||||
if (QFileInfo(subProject).exists())
|
||||
if (QFileInfo::exists(subProject))
|
||||
fileName = subProject;
|
||||
else
|
||||
return link;
|
||||
|
||||
@@ -147,10 +147,7 @@ CMakeManager *CMakeOpenProjectWizard::cmakeManager() const
|
||||
|
||||
bool CMakeOpenProjectWizard::hasInSourceBuild() const
|
||||
{
|
||||
QFileInfo fi(m_sourceDirectory + QLatin1String("/CMakeCache.txt"));
|
||||
if (fi.exists())
|
||||
return true;
|
||||
return false;
|
||||
return QFileInfo::exists(m_sourceDirectory + QLatin1String("/CMakeCache.txt"));
|
||||
}
|
||||
|
||||
bool CMakeOpenProjectWizard::compatibleKitExist() const
|
||||
|
||||
@@ -379,9 +379,9 @@ BaseFileWizardFactory::OverwriteResult BaseFileWizardFactory::promptOverwrite(Ge
|
||||
static const QString symLinkMsg = tr("[symbolic link]");
|
||||
|
||||
foreach (const GeneratedFile &file, *files) {
|
||||
const QFileInfo fi(file.path());
|
||||
if (fi.exists())
|
||||
existingFiles.append(file.path());
|
||||
const QString path = file.path();
|
||||
if (QFileInfo::exists(path))
|
||||
existingFiles.append(path);
|
||||
}
|
||||
if (existingFiles.isEmpty())
|
||||
return OverwriteOk;
|
||||
|
||||
@@ -441,7 +441,7 @@ void HelpManager::verifyDocumenation()
|
||||
{
|
||||
const QStringList ®isteredDocs = d->m_helpEngine->registeredDocumentations();
|
||||
foreach (const QString &nameSpace, registeredDocs) {
|
||||
if (!QFileInfo(d->m_helpEngine->documentationFileName(nameSpace)).exists())
|
||||
if (!QFileInfo::exists(d->m_helpEngine->documentationFileName(nameSpace)))
|
||||
d->m_nameSpacesToUnregister.append(nameSpace);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,8 +410,7 @@ QString ICore::userResourcePath()
|
||||
const QString configDir = QFileInfo(settings(QSettings::UserScope)->fileName()).path();
|
||||
const QString urp = configDir + QLatin1String("/qtcreator");
|
||||
|
||||
QFileInfo fi(urp + QLatin1Char('/'));
|
||||
if (!fi.exists()) {
|
||||
if (!QFileInfo::exists(urp + QLatin1Char('/'))) {
|
||||
QDir dir;
|
||||
if (!dir.mkpath(urp))
|
||||
qWarning() << "could not create" << urp;
|
||||
|
||||
@@ -134,7 +134,7 @@ QList<LocatorFilterEntry> FileSystemFilter::matchesFor(QFutureInterface<Core::Lo
|
||||
|
||||
// "create and open" functionality
|
||||
const QString fullFilePath = dirInfo.filePath(name);
|
||||
if (!QFileInfo(fullFilePath).exists() && dirInfo.exists()) {
|
||||
if (!QFileInfo::exists(fullFilePath) && dirInfo.exists()) {
|
||||
LocatorFilterEntry createAndOpen(this, tr("Create and Open \"%1\"").arg(entry), fullFilePath);
|
||||
createAndOpen.extraInfo = Utils::FileUtils::shortNativePath(
|
||||
Utils::FileName::fromString(dirInfo.absolutePath()));
|
||||
|
||||
@@ -171,8 +171,7 @@ TestActionsTestCase::TestActionsTestCase(const Actions &tokenActions, const Acti
|
||||
// Process all files from the projects
|
||||
foreach (const QString filePath, filesToOpen) {
|
||||
// Skip e.g. "<configuration>"
|
||||
const QFileInfo fileInfo(filePath);
|
||||
if (!fileInfo.exists())
|
||||
if (!QFileInfo::exists(filePath))
|
||||
continue;
|
||||
|
||||
qDebug() << " --" << filePath;
|
||||
|
||||
@@ -123,7 +123,7 @@ public:
|
||||
ExampleProjectConfigurator(const QString &projectFile)
|
||||
{
|
||||
const QString projectUserFile = projectFile + _(".user");
|
||||
QVERIFY(!QFileInfo(projectUserFile).exists());
|
||||
QVERIFY(!QFileInfo::exists(projectUserFile));
|
||||
|
||||
// Open project
|
||||
QString errorOpeningProject;
|
||||
|
||||
@@ -195,7 +195,7 @@ bool TestCase::writeFile(const QString &filePath, const QByteArray &contents)
|
||||
FileWriterAndRemover::FileWriterAndRemover(const QString &filePath, const QByteArray &contents)
|
||||
: m_filePath(filePath)
|
||||
{
|
||||
if (QFileInfo(filePath).exists()) {
|
||||
if (QFileInfo::exists(filePath)) {
|
||||
const QString warning = QString::fromLatin1(
|
||||
"Will not overwrite existing file: \"%1\"."
|
||||
" If this file is left over due to a(n) abort/crash, please remove manually.")
|
||||
|
||||
@@ -1417,7 +1417,7 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
|
||||
//qDebug() << "BP " << rid << data.toString();
|
||||
// Quickly set the location marker.
|
||||
if (lineNumber && !boolSetting(OperateByInstruction)
|
||||
&& QFileInfo(fullName).exists()
|
||||
&& QFileInfo::exists(fullName)
|
||||
&& !isQmlStepBreakpoint(rid)
|
||||
&& !isQFatalBreakpoint(rid))
|
||||
gotoLocation(Location(fullName, lineNumber));
|
||||
|
||||
@@ -172,22 +172,22 @@ void GdbServerStarter::attach(int port)
|
||||
QString binary;
|
||||
QString localExecutable;
|
||||
QString candidate = sysroot + d->process.exe;
|
||||
if (QFileInfo(candidate).exists())
|
||||
if (QFileInfo::exists(candidate))
|
||||
localExecutable = candidate;
|
||||
if (localExecutable.isEmpty()) {
|
||||
binary = d->process.cmdLine.section(QLatin1Char(' '), 0, 0);
|
||||
candidate = sysroot + QLatin1Char('/') + binary;
|
||||
if (QFileInfo(candidate).exists())
|
||||
if (QFileInfo::exists(candidate))
|
||||
localExecutable = candidate;
|
||||
}
|
||||
if (localExecutable.isEmpty()) {
|
||||
candidate = sysroot + QLatin1String("/usr/bin/") + binary;
|
||||
if (QFileInfo(candidate).exists())
|
||||
if (QFileInfo::exists(candidate))
|
||||
localExecutable = candidate;
|
||||
}
|
||||
if (localExecutable.isEmpty()) {
|
||||
candidate = sysroot + QLatin1String("/bin/") + binary;
|
||||
if (QFileInfo(candidate).exists())
|
||||
if (QFileInfo::exists(candidate))
|
||||
localExecutable = candidate;
|
||||
}
|
||||
if (localExecutable.isEmpty()) {
|
||||
|
||||
@@ -768,7 +768,7 @@ void PdbEngine::handleBacktrace(const PdbResponse &response)
|
||||
frame.line = lineNumber;
|
||||
frame.function = _(line.mid(pos2 + 1));
|
||||
frame.usable = QFileInfo(frame.file).isReadable();
|
||||
if (frame.line > 0 && QFileInfo(frame.file).exists()) {
|
||||
if (frame.line > 0 && QFileInfo::exists(frame.file)) {
|
||||
if (line.startsWith("> "))
|
||||
currentIndex = level;
|
||||
frame.level = level;
|
||||
|
||||
@@ -3225,8 +3225,8 @@ bool GitClient::synchronousMerge(const QString &workingDirectory, const QString
|
||||
bool GitClient::canRebase(const QString &workingDirectory) const
|
||||
{
|
||||
const QString gitDir = findGitDirForRepository(workingDirectory);
|
||||
if (QFileInfo(gitDir + QLatin1String("/rebase-apply")).exists()
|
||||
|| QFileInfo(gitDir + QLatin1String("/rebase-merge")).exists()) {
|
||||
if (QFileInfo::exists(gitDir + QLatin1String("/rebase-apply"))
|
||||
|| QFileInfo::exists(gitDir + QLatin1String("/rebase-merge"))) {
|
||||
VcsOutputWindow::appendError(
|
||||
tr("Rebase, merge or am is in progress. Finish "
|
||||
"or abort it and then try again."));
|
||||
|
||||
@@ -117,7 +117,7 @@ void IosRunner::start()
|
||||
}
|
||||
m_cleanExit = false;
|
||||
m_qmlPort = 0;
|
||||
if (!QFileInfo(m_bundleDir).exists()) {
|
||||
if (!QFileInfo::exists(m_bundleDir)) {
|
||||
TaskHub::addTask(Task::Warning,
|
||||
tr("Could not find %1.").arg(m_bundleDir),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
|
||||
|
||||
@@ -181,8 +181,7 @@ void PerforceChecker::parseOutput(const QString &response)
|
||||
return;
|
||||
}
|
||||
// Check existence. No precise check here, might be a symlink
|
||||
const QFileInfo fi(repositoryRoot);
|
||||
if (fi.exists()) {
|
||||
if (QFileInfo::exists(repositoryRoot)) {
|
||||
emitSucceeded(repositoryRoot);
|
||||
} else {
|
||||
emitFailed(tr("The repository \"%1\" does not exist.").
|
||||
|
||||
@@ -203,10 +203,8 @@ void AbstractProcessStep::run(QFutureInterface<bool> &fi)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
QString effectiveCommand = m_param.effectiveCommand();
|
||||
if (!QFileInfo(effectiveCommand).exists()) {
|
||||
if (!QFileInfo::exists(effectiveCommand)) {
|
||||
processStartupFailed();
|
||||
fi.reportResult(false);
|
||||
emit finished();
|
||||
|
||||
@@ -511,7 +511,7 @@ bool JsonWizardFactory::initialize(const QVariantMap &data, const QDir &baseDir,
|
||||
strVal = data.value(QLatin1String(ICON_KEY)).toString();
|
||||
if (!strVal.isEmpty()) {
|
||||
strVal = baseDir.absoluteFilePath(strVal);
|
||||
if (!QFileInfo(strVal).exists()) {
|
||||
if (!QFileInfo::exists(strVal)) {
|
||||
*errorMessage = tr("Icon \"%1\" not found.").arg(strVal);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ void LocalApplicationRunControl::start()
|
||||
if (m_executable.isEmpty()) {
|
||||
appendMessage(tr("No executable specified.") + QLatin1Char('\n'), Utils::ErrorMessageFormat);
|
||||
emit finished();
|
||||
} else if (!QFileInfo(m_executable).exists()){
|
||||
} else if (!QFileInfo::exists(m_executable)) {
|
||||
appendMessage(tr("Executable %1 does not exist.").arg(QDir::toNativeSeparators(m_executable)) + QLatin1Char('\n'),
|
||||
Utils::ErrorMessageFormat);
|
||||
emit finished();
|
||||
|
||||
@@ -308,7 +308,7 @@ static QString winExpandDelayedEnvReferences(QString in, const Utils::Environmen
|
||||
Utils::Environment MsvcToolChain::readEnvironmentSetting(Utils::Environment& env) const
|
||||
{
|
||||
Utils::Environment result = env;
|
||||
if (!QFileInfo(m_vcvarsBat).exists())
|
||||
if (!QFileInfo::exists(m_vcvarsBat))
|
||||
return result;
|
||||
|
||||
QMap<QString, QString> envPairs;
|
||||
@@ -354,7 +354,7 @@ bool MsvcToolChain::isValid() const
|
||||
if (!AbstractMsvcToolChain::isValid())
|
||||
return false;
|
||||
QString vcVarsBat = MsvcToolChainFactory::vcVarsBatFor(QFileInfo(m_vcvarsBat).absolutePath(), m_varsBatArg);
|
||||
return QFileInfo(vcVarsBat).exists();
|
||||
return QFileInfo::exists(vcVarsBat);
|
||||
}
|
||||
|
||||
MsvcToolChain::MsvcToolChain() :
|
||||
|
||||
@@ -117,7 +117,7 @@ static QString winExpandDelayedEnvReferences(QString in, const Utils::Environmen
|
||||
Utils::Environment WinCEToolChain::readEnvironmentSetting(Utils::Environment &env) const
|
||||
{
|
||||
Utils::Environment result = env;
|
||||
if (!QFileInfo(m_vcvarsBat).exists())
|
||||
if (!QFileInfo::exists(m_vcvarsBat))
|
||||
return result;
|
||||
|
||||
// Get the env pairs
|
||||
|
||||
@@ -91,7 +91,7 @@ void QbsProjectParser::parse(const QVariantMap &config, const Environment &env,
|
||||
|
||||
// Some people don't like it when files are created as a side effect of opening a project,
|
||||
// so do not store the build graph if the build directory does not exist yet.
|
||||
params.setDryRun(!QFileInfo(dir).exists());
|
||||
params.setDryRun(!QFileInfo::exists(dir));
|
||||
|
||||
params.setBuildRoot(dir);
|
||||
params.setProjectFilePath(m_projectFilePath);
|
||||
|
||||
@@ -281,7 +281,7 @@ void MakeStep::run(QFutureInterface<bool> & fi)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!QFileInfo(m_makeFileToCheck).exists()) {
|
||||
if (!QFileInfo::exists(m_makeFileToCheck)) {
|
||||
if (!ignoreReturnValue())
|
||||
emit addOutput(tr("Cannot find Makefile. Check your build settings."), BuildStep::MessageOutput);
|
||||
fi.reportResult(ignoreReturnValue());
|
||||
|
||||
@@ -144,7 +144,7 @@ ProFileEditorWidget::Link ProFileEditorWidget::findLinkAt(const QTextCursor &cur
|
||||
if (fi.isDir()) {
|
||||
QDir subDir(fi.absoluteFilePath());
|
||||
QString subProject = subDir.filePath(subDir.dirName() + QLatin1String(".pro"));
|
||||
if (QFileInfo(subProject).exists())
|
||||
if (QFileInfo::exists(subProject))
|
||||
fileName = subProject;
|
||||
else
|
||||
return link;
|
||||
|
||||
@@ -361,7 +361,7 @@ MakeStep *QmakeBuildConfiguration::makeStep() const
|
||||
QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportFrom(const QString &makefile)
|
||||
{
|
||||
QMakeStep *qs = qmakeStep();
|
||||
if (QFileInfo(makefile).exists() && qs) {
|
||||
if (QFileInfo::exists(makefile) && qs) {
|
||||
FileName qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(makefile);
|
||||
BaseQtVersion *version = QtKitInformation::qtVersion(target()->kit());
|
||||
if (!version)
|
||||
@@ -507,7 +507,7 @@ FileName QmakeBuildConfiguration::extractSpecFromArguments(QString *args,
|
||||
// if it is the former we need to get the canonical form
|
||||
// for the other one we don't need to do anything
|
||||
if (parsedSpec.toFileInfo().isRelative()) {
|
||||
if (QFileInfo(directory + QLatin1Char('/') + parsedSpec.toString()).exists())
|
||||
if (QFileInfo::exists(directory + QLatin1Char('/') + parsedSpec.toString()))
|
||||
parsedSpec = FileName::fromUserInput(directory + QLatin1Char('/') + parsedSpec.toString());
|
||||
else
|
||||
parsedSpec = FileName::fromUserInput(baseMkspecDir.toString() + QLatin1Char('/') + parsedSpec.toString());
|
||||
|
||||
@@ -1437,7 +1437,7 @@ bool QmakeProject::requiresTargetPanel() const
|
||||
// but more pratical then duplicated the code everywhere
|
||||
QString QmakeProject::disabledReasonForRunConfiguration(const QString &proFilePath)
|
||||
{
|
||||
if (!QFileInfo(proFilePath).exists())
|
||||
if (!QFileInfo::exists(proFilePath))
|
||||
return tr("The .pro file \"%1\" does not exist.")
|
||||
.arg(QFileInfo(proFilePath).fileName());
|
||||
|
||||
|
||||
@@ -322,7 +322,7 @@ Core::GeneratedFiles QtQuickApp::generateFiles(QString *errorMessage) const
|
||||
files.append(file(generateFile(QtQuickAppGeneratedFileInfo::MainQmlFile, errorMessage), path(MainQml)));
|
||||
files.last().setAttributes(Core::GeneratedFile::OpenEditorAttribute);
|
||||
}
|
||||
if (QFileInfo(path(MainQrcOrigin)).exists()) {
|
||||
if (QFileInfo::exists(path(MainQrcOrigin))) {
|
||||
files.append(file(generateFile(QtQuickAppGeneratedFileInfo::MainQrcFile, errorMessage), path(MainQrc)));
|
||||
}
|
||||
if (!qrcDeployment().isEmpty()) {
|
||||
|
||||
@@ -132,11 +132,11 @@ void FileResourcesModel::openFileDialog()
|
||||
|
||||
|
||||
//Next we try to fall back to the path any file browser was opened with
|
||||
if (!QFileInfo(path).exists())
|
||||
if (!QFileInfo::exists(path))
|
||||
path = s_lastBrowserPath;
|
||||
|
||||
//The last fallback is to try the path of the document
|
||||
if (!QFileInfo(path).exists())
|
||||
if (!QFileInfo::exists(path))
|
||||
path = modelPath;
|
||||
|
||||
QString newFile = QFileDialog::getOpenFileName(Core::ICore::mainWindow(), tr("Open File"), path, m_filter);
|
||||
|
||||
@@ -93,7 +93,7 @@ PropertyEditorQmlBackend::PropertyEditorQmlBackend(PropertyEditorView *propertyE
|
||||
m_view(new Quick2PropertyEditorView), m_propertyEditorTransaction(new PropertyEditorTransaction(propertyEditor)), m_dummyPropertyEditorValue(new PropertyEditorValue()),
|
||||
m_contextObject(new PropertyEditorContextObject())
|
||||
{
|
||||
Q_ASSERT(QFileInfo(":/images/button_normal.png").exists());
|
||||
Q_ASSERT(QFileInfo::exists(":/images/button_normal.png"));
|
||||
|
||||
m_view->engine()->setOutputWarningsToStandardError(
|
||||
!qgetenv("QTCREATOR_QTQUICKDESIGNER_PROPERTYEDITOR_SHOW_WARNINGS").isEmpty());
|
||||
@@ -436,7 +436,7 @@ QString PropertyEditorQmlBackend::fileFromUrl(const QUrl &url)
|
||||
|
||||
bool PropertyEditorQmlBackend::checkIfUrlExists(const QUrl &url)
|
||||
{
|
||||
return (QFileInfo(fileFromUrl(url)).exists());
|
||||
return QFileInfo::exists(fileFromUrl(url));
|
||||
}
|
||||
|
||||
void PropertyEditorQmlBackend::emitSelectionToBeChanged()
|
||||
|
||||
@@ -114,7 +114,7 @@ void AddTabDesignerAction::addNewTab()
|
||||
QString directoryPath = QFileInfo(selectionContext().view()->model()->fileUrl().toLocalFile()).absolutePath();
|
||||
QString newFilePath = directoryPath +QStringLiteral("/") + tabName + QStringLiteral(".qml");
|
||||
|
||||
if (QFileInfo(newFilePath).exists()) {
|
||||
if (QFileInfo::exists(newFilePath)) {
|
||||
QMessageBox::warning(Core::ICore::mainWindow(), tr("Naming Error"), tr("Component already exists."));
|
||||
} else {
|
||||
const QString sourceString = QStringLiteral("import QtQuick 2.1\nimport QtQuick.Controls 1.0\n\nItem {\n anchors.fill: parent\n}");
|
||||
|
||||
@@ -189,7 +189,7 @@ QmlItemNode QmlItemNode::createQmlItemNodeFromImage(AbstractView *view, const QS
|
||||
QString relativeImageName = imageName;
|
||||
|
||||
//use relative path
|
||||
if (QFileInfo(view->model()->fileUrl().toLocalFile()).exists()) {
|
||||
if (QFileInfo::exists(view->model()->fileUrl().toLocalFile())) {
|
||||
QDir fileDir(QFileInfo(view->model()->fileUrl().toLocalFile()).absolutePath());
|
||||
relativeImageName = fileDir.relativeFilePath(imageName);
|
||||
propertyPairList.append(qMakePair(PropertyName("source"), QVariant(relativeImageName)));
|
||||
|
||||
@@ -921,7 +921,7 @@ bool QmlJSCompletionAssistProcessor::completeFileName(const QString &relativeBas
|
||||
} else {
|
||||
directoryPrefix = fileInfo.path();
|
||||
}
|
||||
if (!QFileInfo(directoryPrefix).exists())
|
||||
if (!QFileInfo::exists(directoryPrefix))
|
||||
return false;
|
||||
|
||||
QDirIterator dirIterator(directoryPrefix,
|
||||
|
||||
@@ -63,7 +63,7 @@ QmlBundle BasicBundleProvider::defaultBundle(const QString &bundleInfoName)
|
||||
QString defaultBundlePath = Core::ICore::resourcePath()
|
||||
+ QLatin1String("/qml-type-descriptions/")
|
||||
+ bundleInfoName;
|
||||
if (!QFileInfo(defaultBundlePath).exists()) {
|
||||
if (!QFileInfo::exists(defaultBundlePath)) {
|
||||
qWarning() << "BasicBundleProvider: ERROR " << defaultBundlePath
|
||||
<< " not found";
|
||||
return res;
|
||||
|
||||
@@ -292,8 +292,7 @@ void QmlProjectRunConfiguration::updateEnabled()
|
||||
qmlFileFound = !mainScript().isEmpty();
|
||||
}
|
||||
|
||||
bool newValue = QFileInfo(executable()).exists() && qmlFileFound;
|
||||
|
||||
bool newValue = QFileInfo::exists(executable()) && qmlFileFound;
|
||||
|
||||
// Always emit change signal to force reevaluation of run/debug buttons
|
||||
m_isEnabled = newValue;
|
||||
|
||||
@@ -145,7 +145,7 @@ void BarDescriptorEditorEntryPointWidget::handleIconChanged(const QString &path)
|
||||
emit imageRemoved(m_prevIconPath);
|
||||
|
||||
m_prevIconPath = path;
|
||||
if (QFileInfo(path).exists())
|
||||
if (QFileInfo::exists(path))
|
||||
emit imageAdded(path);
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ void BarDescriptorFileNodeManager::updateBarDescriptorNodes(ProjectExplorer::Pro
|
||||
if (!projectNode)
|
||||
continue;
|
||||
|
||||
if (!QFileInfo(package.appDescriptorPath()).exists()) {
|
||||
if (!QFileInfo::exists(package.appDescriptorPath())) {
|
||||
if (!attemptCreate)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ static bool addQtAssets(BarDescriptorAssetList &assetList, BlackBerryQtVersion *
|
||||
it != qtFolders.constEnd(); ++it) {
|
||||
const QString target = it->first;
|
||||
const QString qtFolder = it->second;
|
||||
if (QFileInfo(qtFolder).exists()) {
|
||||
if (QFileInfo::exists(qtFolder)) {
|
||||
BarDescriptorAsset asset;
|
||||
asset.source = qtFolder;
|
||||
asset.destination = target;
|
||||
|
||||
@@ -114,7 +114,7 @@ void BlackBerryDeployStep::run(QFutureInterface<bool> &fi)
|
||||
|
||||
QList<BarPackageDeployInformation> packagesToDeploy = deployConfig->deploymentInfo()->enabledPackages();
|
||||
foreach (const BarPackageDeployInformation &info, packagesToDeploy) {
|
||||
if (!QFileInfo(info.packagePath()).exists()) {
|
||||
if (!QFileInfo::exists(info.packagePath())) {
|
||||
raiseError(tr("Package \"%1\" does not exist. Create the package first.").arg(info.packagePath()));
|
||||
fi.reportResult(false);
|
||||
return;
|
||||
|
||||
@@ -170,7 +170,7 @@ void BlackBerryDeviceConfigurationWidget::requestDebugToken()
|
||||
void BlackBerryDeviceConfigurationWidget::uploadDebugToken()
|
||||
{
|
||||
// check the debug token path before even laucnhing the uploader process
|
||||
if (!QFileInfo(ui->debugToken->currentText()).exists()) {
|
||||
if (!QFileInfo::exists(ui->debugToken->currentText())) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Invalid debug token path."));
|
||||
return;
|
||||
}
|
||||
@@ -184,7 +184,7 @@ void BlackBerryDeviceConfigurationWidget::uploadDebugToken()
|
||||
void BlackBerryDeviceConfigurationWidget::updateUploadButton()
|
||||
{
|
||||
const QString path = ui->debugToken->currentText();
|
||||
ui->uploadButton->setEnabled(QFileInfo(path).exists());
|
||||
ui->uploadButton->setEnabled(QFileInfo::exists(path));
|
||||
}
|
||||
|
||||
void BlackBerryDeviceConfigurationWidget::uploadFinished(int status)
|
||||
|
||||
@@ -123,7 +123,7 @@ bool BlackBerryRunConfiguration::fromMap(const QVariantMap &map)
|
||||
return false;
|
||||
|
||||
m_proFilePath = map.value(QLatin1String(Constants::QNX_PROFILEPATH_KEY)).toString();
|
||||
if (m_proFilePath.isEmpty() || !QFileInfo(m_proFilePath).exists())
|
||||
if (m_proFilePath.isEmpty() || !QFileInfo::exists(m_proFilePath))
|
||||
return false;
|
||||
|
||||
init();
|
||||
|
||||
@@ -234,7 +234,7 @@ void SigningKeysSetupItem::validate()
|
||||
set(Error, tr("Found legacy BlackBerry signing keys."), tr("Update"));
|
||||
else if (!utils.hasRegisteredKeys())
|
||||
set(Error, tr("Cannot find BlackBerry signing keys."), tr("Request"));
|
||||
else if (!QFileInfo(BlackBerryConfigurationManager::instance()->defaultKeystorePath()).exists())
|
||||
else if (!QFileInfo::exists(BlackBerryConfigurationManager::instance()->defaultKeystorePath()))
|
||||
set(Error, tr("Cannot find developer certificate."), tr("Create"));
|
||||
else if (utils.defaultCertificateOpeningStatus() != BlackBerrySigningUtils::Opened)
|
||||
set(Info, tr("Developer certificate is not opened."), tr("Open"));
|
||||
@@ -249,7 +249,7 @@ void SigningKeysSetupItem::fix()
|
||||
QDesktopServices::openUrl(QUrl(QLatin1String(Qnx::Constants::QNX_LEGACY_KEYS_URL)));
|
||||
} else if (!utils.hasRegisteredKeys()) {
|
||||
QDesktopServices::openUrl(QUrl(QLatin1String(Qnx::Constants::QNX_REGISTER_KEYS_URL)));
|
||||
} else if (!QFileInfo(BlackBerryConfigurationManager::instance()->defaultKeystorePath()).exists()) {
|
||||
} else if (!QFileInfo::exists(BlackBerryConfigurationManager::instance()->defaultKeystorePath())) {
|
||||
set(Info, tr("Opening certificate..."));
|
||||
utils.createCertificate();
|
||||
} else if (utils.defaultCertificateOpeningStatus() != BlackBerrySigningUtils::Opened) {
|
||||
|
||||
@@ -69,23 +69,17 @@ BlackBerrySigningUtils::BlackBerrySigningUtils(QObject *parent) :
|
||||
|
||||
bool BlackBerrySigningUtils::hasRegisteredKeys()
|
||||
{
|
||||
QFileInfo cskFile(BlackBerryConfigurationManager::instance()->idTokenPath());
|
||||
|
||||
return cskFile.exists();
|
||||
return QFileInfo::exists(BlackBerryConfigurationManager::instance()->idTokenPath());
|
||||
}
|
||||
|
||||
bool BlackBerrySigningUtils::hasLegacyKeys()
|
||||
{
|
||||
QFileInfo cskFile(BlackBerryConfigurationManager::instance()->barsignerCskPath());
|
||||
|
||||
return cskFile.exists();
|
||||
return QFileInfo::exists(BlackBerryConfigurationManager::instance()->barsignerCskPath());
|
||||
}
|
||||
|
||||
bool BlackBerrySigningUtils::hasDefaultCertificate()
|
||||
{
|
||||
QFileInfo keystore(BlackBerryConfigurationManager::instance()->defaultKeystorePath());
|
||||
|
||||
return keystore.exists();
|
||||
return QFileInfo::exists(BlackBerryConfigurationManager::instance()->defaultKeystorePath());
|
||||
}
|
||||
|
||||
QString BlackBerrySigningUtils::cskPassword(QWidget *passwordPromptParent, bool *ok)
|
||||
|
||||
@@ -93,7 +93,7 @@ QList<Utils::EnvironmentItem> QnxUtils::qnxEnvironmentFromEnvFile(const QString
|
||||
{
|
||||
QList <Utils::EnvironmentItem> items;
|
||||
|
||||
if (!QFileInfo(fileName).exists())
|
||||
if (!QFileInfo::exists(fileName))
|
||||
return items;
|
||||
|
||||
const bool isWindows = Utils::HostOsInfo::isWindowsHost();
|
||||
@@ -157,7 +157,7 @@ QList<Utils::EnvironmentItem> QnxUtils::qnxEnvironmentFromEnvFile(const QString
|
||||
|
||||
bool QnxUtils::isValidNdkPath(const QString &ndkPath)
|
||||
{
|
||||
return (QFileInfo(envFilePath(ndkPath)).exists());
|
||||
return QFileInfo::exists(envFilePath(ndkPath));
|
||||
}
|
||||
|
||||
QString QnxUtils::envFilePath(const QString &ndkPath, const QString &targetVersion)
|
||||
@@ -168,7 +168,7 @@ QString QnxUtils::envFilePath(const QString &ndkPath, const QString &targetVersi
|
||||
else if (Utils::HostOsInfo::isAnyUnixHost())
|
||||
envFile = ndkPath + QLatin1String("/bbndk-env.sh");
|
||||
|
||||
if (!QFileInfo(envFile).exists()) {
|
||||
if (!QFileInfo::exists(envFile)) {
|
||||
QString version = targetVersion.isEmpty() ? defaultTargetVersion(ndkPath) : targetVersion;
|
||||
version = version.replace(QLatin1Char('.'), QLatin1Char('_'));
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
@@ -268,7 +268,7 @@ QString QnxUtils::sdkInstallerPath(const QString &ndkPath)
|
||||
{
|
||||
QString sdkinstallPath = Utils::HostOsInfo::withExecutableSuffix(ndkPath + QLatin1String("/qde"));
|
||||
|
||||
if (QFileInfo(sdkinstallPath).exists())
|
||||
if (QFileInfo::exists(sdkinstallPath))
|
||||
return sdkinstallPath;
|
||||
|
||||
return QString();
|
||||
|
||||
@@ -1016,35 +1016,30 @@ void BaseQtVersion::updateVersionInfo() const
|
||||
// Now check for a qt that is configured with a prefix but not installed
|
||||
QString installDir = qmakeProperty(m_versionInfo, "QT_HOST_BINS");
|
||||
if (!installDir.isNull()) {
|
||||
QFileInfo fi(installDir);
|
||||
if (!fi.exists())
|
||||
if (!QFileInfo::exists(installDir))
|
||||
m_installed = false;
|
||||
}
|
||||
// Framework builds for Qt 4.8 don't use QT_INSTALL_HEADERS
|
||||
// so we don't check on mac
|
||||
if (!HostOsInfo::isMacHost()) {
|
||||
if (!qtHeaderData.isNull()) {
|
||||
const QFileInfo fi(qtHeaderData);
|
||||
if (!fi.exists())
|
||||
if (!QFileInfo::exists(qtHeaderData))
|
||||
m_installed = false;
|
||||
}
|
||||
}
|
||||
const QString qtInstallDocs = qmakeProperty(m_versionInfo, "QT_INSTALL_DOCS");
|
||||
if (!qtInstallDocs.isNull()) {
|
||||
const QFileInfo fi(qtInstallDocs);
|
||||
if (fi.exists())
|
||||
if (QFileInfo::exists(qtInstallDocs))
|
||||
m_hasDocumentation = true;
|
||||
}
|
||||
const QString qtInstallExamples = qmakeProperty(m_versionInfo, "QT_INSTALL_EXAMPLES");
|
||||
if (!qtInstallExamples.isNull()) {
|
||||
const QFileInfo fi(qtInstallExamples);
|
||||
if (fi.exists())
|
||||
if (QFileInfo::exists(qtInstallExamples))
|
||||
m_hasExamples = true;
|
||||
}
|
||||
const QString qtInstallDemos = qmakeProperty(m_versionInfo, "QT_INSTALL_DEMOS");
|
||||
if (!qtInstallDemos.isNull()) {
|
||||
const QFileInfo fi(qtInstallDemos);
|
||||
if (fi.exists())
|
||||
if (QFileInfo::exists(qtInstallDemos))
|
||||
m_hasDemos = true;
|
||||
}
|
||||
m_qtVersionString = qmakeProperty(m_versionInfo, "QT_VERSION");
|
||||
@@ -1406,7 +1401,7 @@ FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<QString, QString> &ver
|
||||
QString possibleFullPath = QString::fromLocal8Bit(temp.at(1).trimmed().constData());
|
||||
// We sometimes get a mix of different slash styles here...
|
||||
possibleFullPath = possibleFullPath.replace(QLatin1Char('\\'), QLatin1Char('/'));
|
||||
if (QFileInfo(possibleFullPath).exists()) // Only if the path exists
|
||||
if (QFileInfo::exists(possibleFullPath)) // Only if the path exists
|
||||
mkspecFullPath = FileName::fromUserInput(possibleFullPath);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -272,7 +272,7 @@ static bool isValidExampleOrDemo(ExampleItem &item)
|
||||
doesn't have any namespace */
|
||||
QString reason;
|
||||
bool ok = true;
|
||||
if (!item.hasSourceCode || !QFileInfo(item.projectPath).exists()) {
|
||||
if (!item.hasSourceCode || !QFileInfo::exists(item.projectPath)) {
|
||||
ok = false;
|
||||
reason = QString::fromLatin1("projectPath \"%1\" empty or does not exist").arg(item.projectPath);
|
||||
} else if (item.imageUrl.startsWith(invalidPrefix) || !QUrl(item.imageUrl).isValid()) {
|
||||
|
||||
@@ -97,7 +97,7 @@ void TodoPlugin::scanningScopeChanged(ScanningScope scanningScope)
|
||||
|
||||
void TodoPlugin::todoItemClicked(const TodoItem &item)
|
||||
{
|
||||
if (QFileInfo(item.file).exists()) {
|
||||
if (QFileInfo::exists(item.file)) {
|
||||
Core::IEditor *editor = Core::EditorManager::openEditor(item.file);
|
||||
editor->gotoLine(item.line);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ QString ProFileEvaluator::sysrootify(const QString &path, const QString &baseDir
|
||||
const bool isHostSystemPath =
|
||||
option->sysroot.isEmpty() || path.startsWith(option->sysroot, cs)
|
||||
|| path.startsWith(baseDir, cs) || path.startsWith(d->m_outputDir, cs)
|
||||
|| !QFileInfo(option->sysroot + path).exists();
|
||||
|| !QFileInfo::exists(option->sysroot + path);
|
||||
|
||||
return isHostSystemPath ? path : option->sysroot + path;
|
||||
}
|
||||
|
||||
@@ -1895,7 +1895,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFeatureFile(
|
||||
}
|
||||
#ifdef QMAKE_BUILTIN_PRFS
|
||||
fn.prepend(QLatin1String(":/qmake/features/"));
|
||||
if (QFileInfo(fn).exists())
|
||||
if (QFileInfo::exists(fn))
|
||||
goto cool;
|
||||
#endif
|
||||
fn = QLatin1String(""); // Indicate failed lookup. See comment above.
|
||||
|
||||
Reference in New Issue
Block a user