forked from qt-creator/qt-creator
Utils: Simplify FilePath::toFileInfo().lastModified() calls
It's the same as FilePath::lastModified locally, and toFileInfo doesn't work remotely. So it's overall at least not worse. Change-Id: Ice8d80dcfd01dc38edc1dce2b53e1b5e6274380f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -839,7 +839,7 @@ namespace ADS
|
||||
if (!fi.exists() || fi.copy(workspaceNameToFilePath(clone).toString())) {
|
||||
d->m_workspaces.insert(1, clone);
|
||||
d->m_workspaceDateTimes
|
||||
.insert(clone, workspaceNameToFilePath(clone).toFileInfo().lastModified());
|
||||
.insert(clone, workspaceNameToFilePath(clone).lastModified());
|
||||
emit workspaceListChanged();
|
||||
return true;
|
||||
}
|
||||
@@ -918,7 +918,7 @@ namespace ADS
|
||||
} else {
|
||||
d->m_workspaces.insert(1, workspaceName);
|
||||
d->m_workspaceDateTimes.insert(workspaceName,
|
||||
workspaceNameToFilePath(workspaceName).toFileInfo().lastModified());
|
||||
workspaceNameToFilePath(workspaceName).lastModified());
|
||||
d->m_workspaceListDirty = true;
|
||||
// After importing the workspace, update the workspace list
|
||||
workspaces();
|
||||
|
||||
@@ -279,7 +279,7 @@ void AndroidConfig::parseDependenciesJson()
|
||||
QFile::copy(sdkConfigFile.toString(), sdkConfigUserFile.toString());
|
||||
}
|
||||
|
||||
if (sdkConfigFile.toFileInfo().lastModified() > sdkConfigUserFile.toFileInfo().lastModified()) {
|
||||
if (sdkConfigFile.lastModified() > sdkConfigUserFile.lastModified()) {
|
||||
const QString oldUserFile = (sdkConfigUserFile + ".old").toString();
|
||||
QFile::remove(oldUserFile);
|
||||
QFile::rename(sdkConfigUserFile.toString(), oldUserFile);
|
||||
|
||||
@@ -778,7 +778,7 @@ void DebuggerItemManagerPrivate::autoDetectGdbOrLldbDebuggers(const FilePath &de
|
||||
return titem->m_item.command() == command;
|
||||
};
|
||||
if (DebuggerTreeItem *existingItem = m_model->findItemAtLevel<2>(commandMatches)) {
|
||||
if (command.toFileInfo().lastModified() != existingItem->m_item.lastModified())
|
||||
if (command.lastModified() != existingItem->m_item.lastModified())
|
||||
existingItem->m_item.reinitializeFromFile();
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -473,8 +473,8 @@ void IosDebugSupport::start()
|
||||
QString bundlePath = iosRunConfig->bundleDirectory().toString();
|
||||
bundlePath.chop(4);
|
||||
FilePath dsymPath = FilePath::fromString(bundlePath.append(".dSYM"));
|
||||
if (dsymPath.exists() && dsymPath.toFileInfo().lastModified()
|
||||
< QFileInfo(iosRunConfig->localExecutable().toUserOutput()).lastModified()) {
|
||||
if (dsymPath.exists()
|
||||
&& dsymPath.lastModified() < iosRunConfig->localExecutable().lastModified()) {
|
||||
TaskHub::addTask(DeploymentTask(Task::Warning,
|
||||
tr("The dSYM %1 seems to be outdated, it might confuse the debugger.")
|
||||
.arg(dsymPath.toUserOutput())));
|
||||
|
||||
@@ -104,7 +104,7 @@ ExtraCompiler::ExtraCompiler(const Project *project, const Utils::FilePath &sour
|
||||
this, &ExtraCompiler::onEditorAboutToClose);
|
||||
|
||||
// Use existing target files, where possible. Otherwise run the compiler.
|
||||
QDateTime sourceTime = d->source.toFileInfo().lastModified();
|
||||
QDateTime sourceTime = d->source.lastModified();
|
||||
foreach (const Utils::FilePath &target, targets) {
|
||||
QFileInfo targetFileInfo(target.toFileInfo());
|
||||
if (!targetFileInfo.exists()) {
|
||||
@@ -180,7 +180,7 @@ void ExtraCompiler::onTargetsBuilt(Project *project)
|
||||
|
||||
// This is mostly a fall back for the cases when the generator couldn't be run.
|
||||
// It pays special attention to the case where a source file was newly created
|
||||
const QDateTime sourceTime = d->source.toFileInfo().lastModified();
|
||||
const QDateTime sourceTime = d->source.lastModified();
|
||||
if (d->compileTime.isValid() && d->compileTime >= sourceTime)
|
||||
return;
|
||||
|
||||
|
||||
@@ -872,7 +872,7 @@ bool SessionManager::cloneSession(const QString &original, const QString &clone)
|
||||
// If the file does not exist, we can still clone
|
||||
if (!fi.exists() || fi.copy(sessionNameToFileName(clone).toString())) {
|
||||
d->m_sessions.insert(1, clone);
|
||||
d->m_sessionDateTimes.insert(clone, sessionNameToFileName(clone).toFileInfo().lastModified());
|
||||
d->m_sessionDateTimes.insert(clone, sessionNameToFileName(clone).lastModified());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -110,7 +110,7 @@ QDateTime PuppetCreator::qtLastModified() const
|
||||
{
|
||||
QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(m_target->kit());
|
||||
if (currentQtVersion)
|
||||
return currentQtVersion->libraryPath().toFileInfo().lastModified();
|
||||
return currentQtVersion->libraryPath().lastModified();
|
||||
|
||||
return QDateTime();
|
||||
}
|
||||
|
||||
@@ -109,14 +109,14 @@ void DeploymentTimeInfo::saveDeploymentTimeStamp(const DeployableFile &deployabl
|
||||
{
|
||||
d->lastDeployed.insert(
|
||||
d->parameters(deployableFile, kit),
|
||||
{ deployableFile.localFilePath().toFileInfo().lastModified(), remoteTimestamp });
|
||||
{ deployableFile.localFilePath().lastModified(), remoteTimestamp });
|
||||
}
|
||||
|
||||
bool DeploymentTimeInfo::hasLocalFileChanged(const DeployableFile &deployableFile,
|
||||
const Kit *kit) const
|
||||
{
|
||||
const auto &lastDeployed = d->lastDeployed.value(d->parameters(deployableFile, kit));
|
||||
const QDateTime lastModified = deployableFile.localFilePath().toFileInfo().lastModified();
|
||||
const QDateTime lastModified = deployableFile.localFilePath().lastModified();
|
||||
return !lastDeployed.local.isValid() || lastModified != lastDeployed.local;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user