本文整理汇总了C++中QFileSystemEntry::filePath方法的典型用法代码示例。如果您正苦于以下问题:C++ QFileSystemEntry::filePath方法的具体用法?C++ QFileSystemEntry::filePath怎么用?C++ QFileSystemEntry::filePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QFileSystemEntry
的用法示例。
在下文中一共展示了QFileSystemEntry::filePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isPackage
static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &entry)
{
if (!data.isDirectory())
return false;
QFileInfo info(entry.filePath());
QString suffix = info.suffix();
if (suffix.length() > 0) {
// First step: is the extension known ?
CFStringRef extensionRef = QCFString::toCFStringRef(suffix);
CFStringRef uniformTypeIdentifier = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extensionRef, NULL);
if (UTTypeConformsTo(uniformTypeIdentifier, kUTTypeBundle))
return true;
// Second step: check if an application knows the package type
CFStringRef path = QCFString::toCFStringRef(entry.filePath());
QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(0, path, kCFURLPOSIXPathStyle, true);
UInt32 type, creator;
// Well created packages have the PkgInfo file
if (CFBundleGetPackageInfoInDirectory(url, &type, &creator))
return true;
// Find if an application other than Finder claims to know how to handle the package
QCFType<CFURLRef> application;
LSGetApplicationForURL(url,
kLSRolesEditor|kLSRolesViewer|kLSRolesViewer,
NULL,
&application);
if (application) {
QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, application);
CFStringRef identifier = CFBundleGetIdentifier(bundle);
QString applicationId = QCFString::toQString(identifier);
if (applicationId != QLatin1String("com.apple.finder"))
return true;
}
}
// Third step: check if the directory has the package bit set
FSRef packageRef;
FSPathMakeRef((UInt8 *)entry.nativeFilePath().constData(), &packageRef, NULL);
FSCatalogInfo catalogInfo;
FSGetCatalogInfo(&packageRef,
kFSCatInfoFinderInfo,
&catalogInfo,
NULL,
NULL,
NULL);
FolderInfo *folderInfo = reinterpret_cast<FolderInfo *>(catalogInfo.finderInfo);
return folderInfo->finderFlags & kHasBundle;
}
示例2: fileName
QString QFSFileEngine::fileName(FileName file) const
{
Q_D(const QFSFileEngine);
if (file == BundleName) {
return QFileSystemEngine::bundleName(d->fileEntry);
} else if (file == BaseName) {
return d->fileEntry.fileName();
} else if (file == PathName) {
return d->fileEntry.path();
} else if (file == AbsoluteName || file == AbsolutePathName) {
QFileSystemEntry entry(QFileSystemEngine::absoluteName(d->fileEntry));
if (file == AbsolutePathName) {
return entry.path();
}
return entry.filePath();
} else if (file == CanonicalName || file == CanonicalPathName) {
QFileSystemEntry entry(QFileSystemEngine::canonicalName(d->fileEntry, d->metaData));
if (file == CanonicalPathName)
return entry.path();
return entry.filePath();
} else if (file == LinkName) {
if (d->isSymlink()) {
QFileSystemEntry entry = QFileSystemEngine::getLinkTarget(d->fileEntry, d->metaData);
return entry.filePath();
}
return QString();
}
return d->fileEntry.filePath();
}
示例3: defaultCtor
void tst_QFileSystemEntry::defaultCtor()
{
QFileSystemEntry entry;
QVERIFY(entry.filePath().isNull());
QVERIFY(entry.nativeFilePath().isNull());
QVERIFY(entry.fileName().isNull());
QCOMPARE(entry.path(), QString("."));
QVERIFY(entry.baseName().isNull());
QVERIFY(entry.completeBaseName().isNull());
QVERIFY(entry.suffix().isNull());
QVERIFY(entry.completeSuffix().isNull());
QVERIFY(!entry.isAbsolute());
QVERIFY(entry.isRelative());
QVERIFY(entry.isClean());
#if defined(Q_OS_WIN)
QVERIFY(!entry.isDriveRoot());
#endif
QVERIFY(!entry.isRoot());
QVERIFY(entry.isEmpty());
}
示例4: createDirectory
//static
bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool createParents)
{
QString dirName = entry.filePath();
if (createParents) {
dirName = QDir::cleanPath(dirName);
for (int oldslash = -1, slash=0; slash != -1; oldslash = slash) {
slash = dirName.indexOf(QDir::separator(), oldslash+1);
if (slash == -1) {
if (oldslash == dirName.length())
break;
slash = dirName.length();
}
if (slash) {
QByteArray chunk = QFile::encodeName(dirName.left(slash));
QT_STATBUF st;
if (QT_STAT(chunk, &st) != -1) {
if ((st.st_mode & S_IFMT) != S_IFDIR)
return false;
} else if (QT_MKDIR(chunk, 0777) != 0) {
return false;
}
}
}
return true;
}
#if defined(Q_OS_DARWIN) // Mac X doesn't support trailing /'s
if (dirName.endsWith(QLatin1Char('/')))
dirName.chop(1);
#endif
return (QT_MKDIR(QFile::encodeName(dirName), 0777) == 0);
}
示例5: isPackage
static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &entry)
{
if (!data.isDirectory())
return false;
QFileInfo info(entry.filePath());
QString suffix = info.suffix();
if (suffix.length() > 0) {
// First step: is the extension known ?
QCFType<CFStringRef> extensionRef = QCFString::toCFStringRef(suffix);
QCFType<CFStringRef> uniformTypeIdentifier = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extensionRef, NULL);
if (UTTypeConformsTo(uniformTypeIdentifier, kUTTypeBundle))
return true;
// Second step: check if an application knows the package type
QCFType<CFStringRef> path = QCFString::toCFStringRef(entry.filePath());
QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(0, path, kCFURLPOSIXPathStyle, true);
UInt32 type, creator;
// Well created packages have the PkgInfo file
if (CFBundleGetPackageInfoInDirectory(url, &type, &creator))
return true;
#ifdef Q_OS_OSX
// Find if an application other than Finder claims to know how to handle the package
QCFType<CFURLRef> application;
LSGetApplicationForURL(url,
kLSRolesEditor|kLSRolesViewer|kLSRolesViewer,
NULL,
&application);
if (application) {
QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, application);
CFStringRef identifier = CFBundleGetIdentifier(bundle);
QString applicationId = QCFString::toQString(identifier);
if (applicationId != QLatin1String("com.apple.finder"))
return true;
}
#endif
}
// Third step: check if the directory has the package bit set
return hasResourcePropertyFlag(data, entry, kCFURLIsPackageKey);
}
示例6: canonicalName
//static
QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry, QFileSystemMetaData &data)
{
if (entry.isEmpty() || entry.isRoot())
return entry;
#if !defined(Q_OS_MAC) && _POSIX_VERSION < 200809L
// realpath(X,0) is not supported
Q_UNUSED(data);
return QFileSystemEntry(slowCanonicalized(absoluteName(entry).filePath()));
#else
char *ret = 0;
# if defined(Q_OS_MAC)
# if !defined(QT_NO_CORESERVICES)
// Mac OS X 10.5.x doesn't support the realpath(X,0) extension we use here.
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) {
ret = realpath(entry.nativeFilePath().constData(), (char*)0);
} else {
// on 10.5 we can use FSRef to resolve the file path.
QString path = QDir::cleanPath(entry.filePath());
FSRef fsref;
if (FSPathMakeRef((const UInt8 *)path.toUtf8().data(), &fsref, 0) == noErr) {
CFURLRef urlref = CFURLCreateFromFSRef(NULL, &fsref);
CFStringRef canonicalPath = CFURLCopyFileSystemPath(urlref, kCFURLPOSIXPathStyle);
QString ret = QCFString::toQString(canonicalPath);
CFRelease(canonicalPath);
CFRelease(urlref);
return QFileSystemEntry(ret);
}
}
# else
ret = (char*)malloc(PATH_MAX);
realpath(entry.nativeFilePath().constData(), (char*)ret);
# endif //!defined(QT_NO_CORESERVICES)
# else
#ifdef Q_OS_ANDROID
ret = (char*)malloc(PATH_MAX);
memset(ret, 0, PATH_MAX);
ret = realpath(entry.nativeFilePath().constData(), ret);
#else
ret = realpath(entry.nativeFilePath().constData(), (char*)0);
#endif
ret = realpath(entry.nativeFilePath().constData(), (char*)0);
# endif //defined(Q_OS_MAC)
if (ret) {
data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute;
data.entryFlags |= QFileSystemMetaData::ExistsAttribute;
QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret));
free(ret);
return QFileSystemEntry(canonicalPath);
} else if (errno == ENOENT) { // file doesn't exist
data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute;
data.entryFlags &= ~(QFileSystemMetaData::ExistsAttribute);
return QFileSystemEntry();
}
return entry;
#endif
}
示例7: removeDirectory
//static
bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool removeEmptyParents)
{
if (removeEmptyParents) {
QString dirName = QDir::cleanPath(entry.filePath());
for (int oldslash = 0, slash=dirName.length(); slash > 0; oldslash = slash) {
QByteArray chunk = QFile::encodeName(dirName.left(slash));
QT_STATBUF st;
if (QT_STAT(chunk, &st) != -1) {
if ((st.st_mode & S_IFMT) != S_IFDIR)
return false;
if (::rmdir(chunk) != 0)
return oldslash != 0;
} else {
return false;
}
slash = dirName.lastIndexOf(QDir::separator(), oldslash-1);
}
return true;
}
return rmdir(QFile::encodeName(entry.filePath())) == 0;
}
示例8: bundleName
//static
QString QFileSystemEngine::bundleName(const QFileSystemEntry &entry)
{
QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(0, QCFString(entry.filePath()),
kCFURLPOSIXPathStyle, true);
if (QCFType<CFDictionaryRef> dict = CFBundleCopyInfoDictionaryForURL(url)) {
if (CFTypeRef name = (CFTypeRef)CFDictionaryGetValue(dict, kCFBundleNameKey)) {
if (CFGetTypeID(name) == CFStringGetTypeID())
return QCFString::toQString((CFStringRef)name);
}
}
return QString();
}
示例9: _q_resolveEntryAndCreateLegacyEngine_recursive
static bool _q_resolveEntryAndCreateLegacyEngine_recursive(QFileSystemEntry &entry, QFileSystemMetaData &data,
QAbstractFileEngine *&engine, bool resolvingEntry = false)
{
QString const &filePath = entry.filePath();
if ((engine = qt_custom_file_engine_handler_create(filePath)))
return _q_checkEntry(engine, resolvingEntry);
#if defined(QT_BUILD_CORE_LIB)
for (int prefixSeparator = 0; prefixSeparator < filePath.size(); ++prefixSeparator) {
QChar const ch = filePath[prefixSeparator];
if (ch == QLatin1Char('/'))
break;
if (ch == QLatin1Char(':')) {
if (prefixSeparator == 0) {
engine = new QResourceFileEngine(filePath);
return _q_checkEntry(engine, resolvingEntry);
}
if (prefixSeparator == 1)
break;
const QStringList &paths = QDir::searchPaths(filePath.left(prefixSeparator));
for (int i = 0; i < paths.count(); i++) {
entry = QFileSystemEntry(QDir::cleanPath(paths.at(i) % QLatin1Char('/') % filePath.mid(prefixSeparator + 1)));
// Recurse!
if (_q_resolveEntryAndCreateLegacyEngine_recursive(entry, data, engine, true))
return true;
}
// entry may have been clobbered at this point.
return false;
}
// There's no need to fully validate the prefix here. Consulting the
// unicode tables could be expensive and validation is already
// performed in QDir::setSearchPaths.
//
// if (!ch.isLetterOrNumber())
// break;
}
#endif // defined(QT_BUILD_CORE_LIB)
return _q_checkEntry(entry, data, resolvingEntry);
}
示例10: createDirectory
//static
bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool createParents)
{
QString dirName = entry.filePath();
if (createParents) {
dirName = QDir::cleanPath(dirName);
for (int oldslash = -1, slash=0; slash != -1; oldslash = slash) {
slash = dirName.indexOf(QDir::separator(), oldslash+1);
if (slash == -1) {
if (oldslash == dirName.length())
break;
slash = dirName.length();
}
if (slash) {
const QByteArray chunk = QFile::encodeName(dirName.left(slash));
if (QT_MKDIR(chunk.constData(), 0777) != 0) {
if (errno == EEXIST
#if defined(Q_OS_QNX)
// On QNX the QNet (VFS paths of other hosts mounted under a directory
// such as /net) mountpoint returns ENOENT, despite existing. stat()
// on the QNet mountpoint returns successfully and reports S_IFDIR.
|| errno == ENOENT
#endif
) {
QT_STATBUF st;
if (QT_STAT(chunk.constData(), &st) == 0 && (st.st_mode & S_IFMT) == S_IFDIR)
continue;
}
return false;
}
}
}
return true;
}
#if defined(Q_OS_DARWIN) // Mac X doesn't support trailing /'s
if (dirName.endsWith(QLatin1Char('/')))
dirName.chop(1);
#endif
return (QT_MKDIR(QFile::encodeName(dirName).constData(), 0777) == 0);
}
示例11: absoluteName
//static
QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
{
QString orig = entry.filePath();
const bool isAbsolute = entry.isAbsolute();
const bool isDirty = !entry.isClean();
if (isAbsolute && !isDirty)
return entry;
const bool isRelative = entry.isRelative();
const bool needsDrive = (!orig.isEmpty() && orig.at(0).unicode() == '/');
const bool isDriveLetter = !needsDrive && !isAbsolute && !isRelative && orig.length() == 2;
const bool isDriveRelative = !needsDrive && !isAbsolute && !isRelative && orig.length() > 2;
QString result;
if (needsDrive || isDriveLetter || isDriveRelative || !isAbsolute || orig.isEmpty()) {
QFileSystemEntry cur(currentPath());
if(needsDrive)
result = cur.filePath().left(2);
else if(isDriveRelative && cur.filePath().at(0) != orig.at(0))
result = orig.left(2); // for BC, see tst_QFileInfo::absolutePath(<not current drive>:my.dll)
else
result = cur.filePath();
if(isDriveLetter) {
result[0] = orig.at(0); //copy drive letter
orig.clear();
}
if(isDriveRelative) {
orig = orig.mid(2); //discard the drive specifier from orig
}
}
if (!orig.isEmpty() && !(orig.length() == 1 && orig.at(0).unicode() == '.')) {
if (!result.isEmpty() && !result.endsWith(QLatin1Char('/')))
result.append(QLatin1Char('/'));
result.append(orig);
}
return QFileSystemEntry(symbianCleanAbsolutePath(result), QFileSystemEntry::FromInternalPath());
}
示例12: setCurrentPath
//static
bool QFileSystemEngine::setCurrentPath(const QFileSystemEntry &entry)
{
QFileSystemMetaData meta;
QFileSystemEntry absname = absoluteName(entry);
fillMetaData(absname, meta, QFileSystemMetaData::ExistsAttribute | QFileSystemMetaData::DirectoryType);
if(!(meta.exists() && meta.isDirectory()))
return false;
RFs& fs = qt_s60GetRFs();
QString abspath = absname.nativeFilePath();
if(!abspath.endsWith(QLatin1Char('\\')))
abspath.append(QLatin1Char('\\'));
TInt r = fs.SetSessionPath(qt_QString2TPtrC(abspath));
//SetSessionPath succeeds for non existent directory, which is why it's checked above
if (r == KErrNone) {
__ASSERT_COMPILE(sizeof(wchar_t) == sizeof(unsigned short));
//attempt to set open C to the same path
r = ::wchdir(reinterpret_cast<const wchar_t *>(absname.filePath().utf16()));
if (r < 0)
qWarning("failed to sync path to open C");
return true;
}
return false;
}
示例13: getLinkTarget
//static
QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link, QFileSystemMetaData &data)
{
#if defined(__GLIBC__) && !defined(PATH_MAX)
#define PATH_CHUNK_SIZE 256
char *s = 0;
int len = -1;
int size = PATH_CHUNK_SIZE;
while (1) {
s = (char *) ::realloc(s, size);
Q_CHECK_PTR(s);
len = ::readlink(link.nativeFilePath().constData(), s, size);
if (len < 0) {
::free(s);
break;
}
if (len < size) {
break;
}
size *= 2;
}
#else
char s[PATH_MAX+1];
int len = readlink(link.nativeFilePath().constData(), s, PATH_MAX);
#endif
if (len > 0) {
QString ret;
if (!data.hasFlags(QFileSystemMetaData::DirectoryType))
fillMetaData(link, data, QFileSystemMetaData::DirectoryType);
if (data.isDirectory() && s[0] != '/') {
QDir parent(link.filePath());
parent.cdUp();
ret = parent.path();
if (!ret.isEmpty() && !ret.endsWith(QLatin1Char('/')))
ret += QLatin1Char('/');
}
s[len] = '\0';
ret += QFile::decodeName(QByteArray(s));
#if defined(__GLIBC__) && !defined(PATH_MAX)
::free(s);
#endif
if (!ret.startsWith(QLatin1Char('/'))) {
if (link.filePath().startsWith(QLatin1Char('/'))) {
ret.prepend(link.filePath().left(link.filePath().lastIndexOf(QLatin1Char('/')))
+ QLatin1Char('/'));
} else {
ret.prepend(QDir::currentPath() + QLatin1Char('/'));
}
}
ret = QDir::cleanPath(ret);
if (ret.size() > 1 && ret.endsWith(QLatin1Char('/')))
ret.chop(1);
return QFileSystemEntry(ret);
}
#if !defined(QWS) && !defined(Q_WS_QPA) && defined(Q_OS_MAC)
{
FSRef fref;
if (FSPathMakeRef((const UInt8 *)QFile::encodeName(QDir::cleanPath(link.filePath())).data(), &fref, 0) == noErr) {
// TODO get the meta data info from the QFileSystemMetaData object
Boolean isAlias, isFolder;
if (FSResolveAliasFile(&fref, true, &isFolder, &isAlias) == noErr && isAlias) {
AliasHandle alias;
if (FSNewAlias(0, &fref, &alias) == noErr && alias) {
QCFString cfstr;
if (FSCopyAliasInfo(alias, 0, 0, &cfstr, 0, 0) == noErr)
return QFileSystemEntry(QCFString::toQString(cfstr));
}
}
}
}
#endif
return QFileSystemEntry();
}
示例14: canonicalName
//static
QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry, QFileSystemMetaData &data)
{
if (entry.isEmpty() || entry.isRoot())
return entry;
#if !defined(Q_OS_MAC) && !defined(Q_OS_QNX) && !defined(Q_OS_ANDROID) && _POSIX_VERSION < 200809L
// realpath(X,0) is not supported
Q_UNUSED(data);
return QFileSystemEntry(slowCanonicalized(absoluteName(entry).filePath()));
#else
char *ret = 0;
# if defined(Q_OS_MACX)
// When using -mmacosx-version-min=10.4, we get the legacy realpath implementation,
// which does not work properly with the realpath(X,0) form. See QTBUG-28282.
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) {
ret = (char*)malloc(PATH_MAX + 1);
if (ret && realpath(entry.nativeFilePath().constData(), (char*)ret) == 0) {
const int savedErrno = errno; // errno is checked below, and free() might change it
free(ret);
errno = savedErrno;
ret = 0;
}
} else {
// on 10.5 we can use FSRef to resolve the file path.
QString path = QDir::cleanPath(entry.filePath());
FSRef fsref;
if (FSPathMakeRef((const UInt8 *)path.toUtf8().data(), &fsref, 0) == noErr) {
CFURLRef urlref = CFURLCreateFromFSRef(NULL, &fsref);
CFStringRef canonicalPath = CFURLCopyFileSystemPath(urlref, kCFURLPOSIXPathStyle);
QString ret = QCFString::toQString(canonicalPath);
CFRelease(canonicalPath);
CFRelease(urlref);
return QFileSystemEntry(ret);
}
}
# else
# if _POSIX_VERSION >= 200801L
ret = realpath(entry.nativeFilePath().constData(), (char*)0);
# else
ret = (char*)malloc(PATH_MAX + 1);
if (realpath(entry.nativeFilePath().constData(), (char*)ret) == 0) {
const int savedErrno = errno; // errno is checked below, and free() might change it
free(ret);
errno = savedErrno;
ret = 0;
}
# endif
# endif
if (ret) {
data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute;
data.entryFlags |= QFileSystemMetaData::ExistsAttribute;
QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret));
free(ret);
return QFileSystemEntry(canonicalPath);
} else if (errno == ENOENT) { // file doesn't exist
data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute;
data.entryFlags &= ~(QFileSystemMetaData::ExistsAttribute);
return QFileSystemEntry();
}
return entry;
#endif
}
示例15: getLinkTarget
//static
QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link, QFileSystemMetaData &data)
{
#if defined(__GLIBC__) && !defined(PATH_MAX)
#define PATH_CHUNK_SIZE 256
char *s = 0;
int len = -1;
int size = PATH_CHUNK_SIZE;
while (1) {
s = (char *) ::realloc(s, size);
Q_CHECK_PTR(s);
len = ::readlink(link.nativeFilePath().constData(), s, size);
if (len < 0) {
::free(s);
break;
}
if (len < size) {
break;
}
size *= 2;
}
#else
char s[PATH_MAX+1];
int len = readlink(link.nativeFilePath().constData(), s, PATH_MAX);
#endif
if (len > 0) {
QString ret;
if (!data.hasFlags(QFileSystemMetaData::DirectoryType))
fillMetaData(link, data, QFileSystemMetaData::DirectoryType);
if (data.isDirectory() && s[0] != '/') {
QDir parent(link.filePath());
parent.cdUp();
ret = parent.path();
if (!ret.isEmpty() && !ret.endsWith(QLatin1Char('/')))
ret += QLatin1Char('/');
}
s[len] = '\0';
ret += QFile::decodeName(QByteArray(s));
#if defined(__GLIBC__) && !defined(PATH_MAX)
::free(s);
#endif
if (!ret.startsWith(QLatin1Char('/'))) {
if (link.filePath().startsWith(QLatin1Char('/'))) {
ret.prepend(link.filePath().left(link.filePath().lastIndexOf(QLatin1Char('/')))
+ QLatin1Char('/'));
} else {
ret.prepend(QDir::currentPath() + QLatin1Char('/'));
}
}
ret = QDir::cleanPath(ret);
if (ret.size() > 1 && ret.endsWith(QLatin1Char('/')))
ret.chop(1);
return QFileSystemEntry(ret);
}
#if defined(Q_OS_DARWIN)
{
QCFString path = CFStringCreateWithFileSystemRepresentation(0,
QFile::encodeName(QDir::cleanPath(link.filePath())).data());
if (!path)
return QFileSystemEntry();
QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(0, path, kCFURLPOSIXPathStyle,
data.hasFlags(QFileSystemMetaData::DirectoryType));
if (!url)
return QFileSystemEntry();
QCFType<CFDataRef> bookmarkData = CFURLCreateBookmarkDataFromFile(0, url, NULL);
if (!bookmarkData)
return QFileSystemEntry();
QCFType<CFURLRef> resolvedUrl = CFURLCreateByResolvingBookmarkData(0,
bookmarkData,
(CFURLBookmarkResolutionOptions)(kCFBookmarkResolutionWithoutUIMask
| kCFBookmarkResolutionWithoutMountingMask), NULL, NULL, NULL, NULL);
if (!resolvedUrl)
return QFileSystemEntry();
QCFString cfstr(CFURLCopyFileSystemPath(resolvedUrl, kCFURLPOSIXPathStyle));
if (!cfstr)
return QFileSystemEntry();
return QFileSystemEntry(QCFString::toQString(cfstr));
}
#endif
return QFileSystemEntry();
}