mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
return QString from QFileSystemEngine::getLinkTarget() and rename it
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
7fa203e795
commit
31475726fb
4 changed files with 8 additions and 10 deletions
|
@ -477,8 +477,7 @@ QString QFile::readLink() const
|
|||
if (!d->metaData.hasFlags(QFileSystemMetaData::LinkType))
|
||||
QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::LinkType);
|
||||
if (d->metaData.isLink()) {
|
||||
QFileSystemEntry entry = QFileSystemEngine::getLinkTarget(d->fileEntry, d->metaData);
|
||||
return entry.filePath();
|
||||
return QFileSystemEngine::linkTarget(d->fileEntry, d->metaData);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
@ -499,8 +498,7 @@ QString QFile::readLink(const QString &fileName)
|
|||
QFileSystemEntry fileEntry(fileName);
|
||||
QFileSystemEngine::fillMetaData(fileEntry, metaData, QFileSystemMetaData::LinkType);
|
||||
if (metaData.isLink()) {
|
||||
QFileSystemEntry entry = QFileSystemEngine::getLinkTarget(fileEntry, metaData);
|
||||
return entry.filePath();
|
||||
return QFileSystemEngine::linkTarget(fileEntry, metaData);;
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ QString QFileInfoPrivate::getFileName(const QFileInfoPrivate::FileName name) con
|
|||
break;
|
||||
}
|
||||
case FileName::LinkName:
|
||||
ret = QFileSystemEngine::getLinkTarget(fileEntry, metaData).filePath();
|
||||
ret = QFileSystemEngine::linkTarget(fileEntry, metaData);
|
||||
break;
|
||||
case FileName::AbsoluteName:
|
||||
case FileName::AbsolutePathName: {
|
||||
|
|
|
@ -42,7 +42,7 @@ QT_BEGIN_NAMESPACE
|
|||
class QFileSystemEngine
|
||||
{
|
||||
public:
|
||||
static QFileSystemEntry getLinkTarget(const QFileSystemEntry &link, QFileSystemMetaData &data);
|
||||
static QString linkTarget(const QFileSystemEntry &link, QFileSystemMetaData &data);
|
||||
static QFileSystemEntry canonicalName(const QFileSystemEntry &entry, QFileSystemMetaData &data);
|
||||
static QFileSystemEntry absoluteName(const QFileSystemEntry &entry);
|
||||
static QString resolveUserName(const QFileSystemEntry &entry, QFileSystemMetaData &data);
|
||||
|
|
|
@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
|
|||
const uint QFileSystemMetaData::nobodyID = (uint) -2;
|
||||
|
||||
//static
|
||||
QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link, QFileSystemMetaData &data)
|
||||
QString QFileSystemEngine::linkTarget(const QFileSystemEntry &link, QFileSystemMetaData &data)
|
||||
{
|
||||
QByteArray lpath = link.nativeFilePath();
|
||||
QSTACKARRAY(char, readlinkbuf, PATH_MAX);
|
||||
|
@ -72,9 +72,9 @@ QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link,
|
|||
ret = QDir::cleanPath(ret);
|
||||
if (ret.size() > 1 && ret.endsWith(QLatin1Char('/')))
|
||||
ret.chop(1);
|
||||
return QFileSystemEntry(ret);
|
||||
return ret;
|
||||
}
|
||||
return QFileSystemEntry();
|
||||
return QString();
|
||||
}
|
||||
|
||||
//static
|
||||
|
@ -88,7 +88,7 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry,
|
|||
char *ret = ::realpath(path.constData(), realpathbuf);
|
||||
if (ret) {
|
||||
data.entryFlags |= QFileSystemMetaData::ExistsAttribute;
|
||||
QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret));
|
||||
QString canonicalPath = QDir::cleanPath(QFile::decodeName(ret));
|
||||
return QFileSystemEntry(canonicalPath);
|
||||
} else if (errno == ENOENT) { // file doesn't exist
|
||||
data.entryFlags &= ~(QFileSystemMetaData::ExistsAttribute);
|
||||
|
|
Loading…
Add table
Reference in a new issue