mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +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))
|
if (!d->metaData.hasFlags(QFileSystemMetaData::LinkType))
|
||||||
QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::LinkType);
|
QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::LinkType);
|
||||||
if (d->metaData.isLink()) {
|
if (d->metaData.isLink()) {
|
||||||
QFileSystemEntry entry = QFileSystemEngine::getLinkTarget(d->fileEntry, d->metaData);
|
return QFileSystemEngine::linkTarget(d->fileEntry, d->metaData);
|
||||||
return entry.filePath();
|
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
@ -499,8 +498,7 @@ QString QFile::readLink(const QString &fileName)
|
||||||
QFileSystemEntry fileEntry(fileName);
|
QFileSystemEntry fileEntry(fileName);
|
||||||
QFileSystemEngine::fillMetaData(fileEntry, metaData, QFileSystemMetaData::LinkType);
|
QFileSystemEngine::fillMetaData(fileEntry, metaData, QFileSystemMetaData::LinkType);
|
||||||
if (metaData.isLink()) {
|
if (metaData.isLink()) {
|
||||||
QFileSystemEntry entry = QFileSystemEngine::getLinkTarget(fileEntry, metaData);
|
return QFileSystemEngine::linkTarget(fileEntry, metaData);;
|
||||||
return entry.filePath();
|
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ QString QFileInfoPrivate::getFileName(const QFileInfoPrivate::FileName name) con
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FileName::LinkName:
|
case FileName::LinkName:
|
||||||
ret = QFileSystemEngine::getLinkTarget(fileEntry, metaData).filePath();
|
ret = QFileSystemEngine::linkTarget(fileEntry, metaData);
|
||||||
break;
|
break;
|
||||||
case FileName::AbsoluteName:
|
case FileName::AbsoluteName:
|
||||||
case FileName::AbsolutePathName: {
|
case FileName::AbsolutePathName: {
|
||||||
|
|
|
@ -42,7 +42,7 @@ QT_BEGIN_NAMESPACE
|
||||||
class QFileSystemEngine
|
class QFileSystemEngine
|
||||||
{
|
{
|
||||||
public:
|
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 canonicalName(const QFileSystemEntry &entry, QFileSystemMetaData &data);
|
||||||
static QFileSystemEntry absoluteName(const QFileSystemEntry &entry);
|
static QFileSystemEntry absoluteName(const QFileSystemEntry &entry);
|
||||||
static QString resolveUserName(const QFileSystemEntry &entry, QFileSystemMetaData &data);
|
static QString resolveUserName(const QFileSystemEntry &entry, QFileSystemMetaData &data);
|
||||||
|
|
|
@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
|
||||||
const uint QFileSystemMetaData::nobodyID = (uint) -2;
|
const uint QFileSystemMetaData::nobodyID = (uint) -2;
|
||||||
|
|
||||||
//static
|
//static
|
||||||
QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link, QFileSystemMetaData &data)
|
QString QFileSystemEngine::linkTarget(const QFileSystemEntry &link, QFileSystemMetaData &data)
|
||||||
{
|
{
|
||||||
QByteArray lpath = link.nativeFilePath();
|
QByteArray lpath = link.nativeFilePath();
|
||||||
QSTACKARRAY(char, readlinkbuf, PATH_MAX);
|
QSTACKARRAY(char, readlinkbuf, PATH_MAX);
|
||||||
|
@ -72,9 +72,9 @@ QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link,
|
||||||
ret = QDir::cleanPath(ret);
|
ret = QDir::cleanPath(ret);
|
||||||
if (ret.size() > 1 && ret.endsWith(QLatin1Char('/')))
|
if (ret.size() > 1 && ret.endsWith(QLatin1Char('/')))
|
||||||
ret.chop(1);
|
ret.chop(1);
|
||||||
return QFileSystemEntry(ret);
|
return ret;
|
||||||
}
|
}
|
||||||
return QFileSystemEntry();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
//static
|
||||||
|
@ -88,7 +88,7 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry,
|
||||||
char *ret = ::realpath(path.constData(), realpathbuf);
|
char *ret = ::realpath(path.constData(), realpathbuf);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
data.entryFlags |= QFileSystemMetaData::ExistsAttribute;
|
data.entryFlags |= QFileSystemMetaData::ExistsAttribute;
|
||||||
QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret));
|
QString canonicalPath = QDir::cleanPath(QFile::decodeName(ret));
|
||||||
return QFileSystemEntry(canonicalPath);
|
return QFileSystemEntry(canonicalPath);
|
||||||
} else if (errno == ENOENT) { // file doesn't exist
|
} else if (errno == ENOENT) { // file doesn't exist
|
||||||
data.entryFlags &= ~(QFileSystemMetaData::ExistsAttribute);
|
data.entryFlags &= ~(QFileSystemMetaData::ExistsAttribute);
|
||||||
|
|
Loading…
Add table
Reference in a new issue