forked from qt-creator/qt-creator
Utils: Add FilePath::symLinkTarget
And implement it for the docker device. This replaces the previous unused and not really implemented FilePath::resolveSymLinkTarget. Change-Id: I9dcb4f8276dbb88b21959276da0d50135742fba0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -391,13 +391,6 @@ FilePath FilePath::resolvePath(const QString &fileName) const
|
||||
return FilePath::fromString(QDir::cleanPath(toString() + QLatin1Char('/') + fileName));
|
||||
}
|
||||
|
||||
FilePath FilePath::resolveSymlinkTarget() const
|
||||
{
|
||||
// FIXME: implement
|
||||
QTC_CHECK(false);
|
||||
return *this;
|
||||
}
|
||||
|
||||
FilePath FilePath::cleanPath() const
|
||||
{
|
||||
FilePath result = *this;
|
||||
@@ -1009,6 +1002,19 @@ bool FilePath::needsDevice() const
|
||||
return !m_scheme.isEmpty();
|
||||
}
|
||||
|
||||
/// \returns an empty FilePath if this is not a symbolic linl
|
||||
FilePath FilePath::symLinkTarget() const
|
||||
{
|
||||
if (needsDevice()) {
|
||||
QTC_ASSERT(s_deviceHooks.symLinkTarget, return {});
|
||||
return s_deviceHooks.symLinkTarget(*this);
|
||||
}
|
||||
const QFileInfo info(m_data);
|
||||
if (!info.isSymLink())
|
||||
return {};
|
||||
return FilePath::fromString(info.symLinkTarget());
|
||||
}
|
||||
|
||||
|
||||
/// Find the parent directory of a given directory.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user