Rename LinkName to AbsoluteLinkTarget
The existing symLinkTarget() always resolves the symlink target to an absolute path; It will be clearer to change LinkName to AbsoluteLinkTarget. It is ready for the commit about add symLinkPath() to read the raw link path. Fixes: QTBUG-96761 Change-Id: I8da7e23b066c9ac1a16abb691aa1c4a5f1ff8361 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Wang Fei <wangfeia@uniontech.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
d39b5f376d
commit
62c2d990f9
@ -262,9 +262,9 @@ QAbstractFileEngine *QAbstractFileEngine::create(const QString &fileName)
|
||||
the base name).
|
||||
\value AbsolutePathName The absolute path to the file (excluding
|
||||
the base name).
|
||||
\value LinkName The full file name of the file that this file is a
|
||||
\value AbsoluteLinkTarget The full file name of the file that this file is a
|
||||
link to. (This will be empty if this file is not a link.)
|
||||
\value CanonicalName Often very similar to LinkName. Will return the true path to the file.
|
||||
\value CanonicalName Often very similar to AbsoluteLinkTarget. Will return the true path to the file.
|
||||
\value CanonicalPathName Same as CanonicalName, excluding the base name.
|
||||
\value BundleName Returns the name of the bundle implies BundleType is set.
|
||||
\value JunctionName The full name of the directory that this NTFS junction
|
||||
|
@ -102,7 +102,7 @@ public:
|
||||
PathName,
|
||||
AbsoluteName,
|
||||
AbsolutePathName,
|
||||
LinkName,
|
||||
AbsoluteLinkTarget,
|
||||
CanonicalName,
|
||||
CanonicalPathName,
|
||||
BundleName,
|
||||
|
@ -412,7 +412,7 @@ QFile::exists(const QString &fileName)
|
||||
QString QFile::symLinkTarget() const
|
||||
{
|
||||
Q_D(const QFile);
|
||||
return d->engine()->fileName(QAbstractFileEngine::LinkName);
|
||||
return d->engine()->fileName(QAbstractFileEngine::AbsoluteLinkTarget);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -67,7 +67,7 @@ QString QFileInfoPrivate::getFileName(QAbstractFileEngine::FileName name) const
|
||||
ret = entry.path();
|
||||
break;
|
||||
}
|
||||
case QAbstractFileEngine::LinkName:
|
||||
case QAbstractFileEngine::AbsoluteLinkTarget:
|
||||
ret = QFileSystemEngine::getLinkTarget(fileEntry, metaData).filePath();
|
||||
break;
|
||||
case QAbstractFileEngine::JunctionName:
|
||||
@ -1224,7 +1224,7 @@ QString QFileInfo::symLinkTarget() const
|
||||
Q_D(const QFileInfo);
|
||||
if (d->isDefaultConstructed)
|
||||
return QLatin1String("");
|
||||
return d->getFileName(QAbstractFileEngine::LinkName);
|
||||
return d->getFileName(QAbstractFileEngine::AbsoluteLinkTarget);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -470,7 +470,7 @@ QString QFSFileEngine::fileName(FileName file) const
|
||||
QFileSystemEntry entry(QFileSystemEngine::canonicalName(d->fileEntry, d->metaData));
|
||||
return file == CanonicalPathName ? entry.path() : entry.filePath();
|
||||
}
|
||||
case LinkName:
|
||||
case AbsoluteLinkTarget:
|
||||
if (d->isSymlink()) {
|
||||
QFileSystemEntry entry = QFileSystemEngine::getLinkTarget(d->fileEntry, d->metaData);
|
||||
return entry.filePath();
|
||||
|
@ -646,7 +646,7 @@ QString QFSFileEngine::fileName(FileName file) const
|
||||
return entry.path();
|
||||
return entry.filePath();
|
||||
}
|
||||
case LinkName:
|
||||
case AbsoluteLinkTarget:
|
||||
return QFileSystemEngine::getLinkTarget(d->fileEntry, d->metaData).filePath();
|
||||
case BundleName:
|
||||
return QString();
|
||||
|
@ -439,7 +439,7 @@ bool QTemporaryFileEngine::close()
|
||||
QString QTemporaryFileEngine::fileName(QAbstractFileEngine::FileName file) const
|
||||
{
|
||||
if (isUnnamedFile()) {
|
||||
if (file == LinkName) {
|
||||
if (file == AbsoluteLinkTarget) {
|
||||
// we know our file isn't (won't be) a symlink
|
||||
return QString();
|
||||
}
|
||||
|
@ -265,8 +265,8 @@ public:
|
||||
return QLatin1String("AbsoluteName");
|
||||
case AbsolutePathName:
|
||||
return QLatin1String("AbsolutePathName");
|
||||
case LinkName:
|
||||
return QLatin1String("LinkName");
|
||||
case AbsoluteLinkTarget:
|
||||
return QLatin1String("AbsoluteLinkTarget");
|
||||
case CanonicalName:
|
||||
return QLatin1String("CanonicalName");
|
||||
case CanonicalPathName:
|
||||
|
Loading…
x
Reference in New Issue
Block a user