43 #include <QtCore/qdir.h> 44 #include <QtCore/qset.h> 45 #include <QtCore/qstringbuilder.h> 46 #include <QtCore/private/qabstractfileengine_p.h> 47 #ifdef QT_BUILD_CORE_LIB 48 #include <QtCore/private/qresource_p.h> 77 if (separatorPos == 0) {
78 if (tmpPath.
size() >= 2 && tmpPath.
at(0) == slash && tmpPath.
at(1) == slash) {
80 separatorPos = tmpPath.
indexOf(slash, 2);
81 }
else if (tmpPath.
size() >= 3 && tmpPath.
at(1) ==
QLatin1Char(
':') && tmpPath.
at(2) == slash) {
86 if (separatorPos != -1)
88 separatorPos = tmpPath.
indexOf(slash, separatorPos + 1);
89 QString prefix = separatorPos == -1 ? tmpPath : tmpPath.
left(separatorPos);
104 if (separatorPos != -1) {
105 if (fi.
isDir() && !target.endsWith(slash))
107 target.
append(tmpPath.
mid(separatorPos));
116 nonSymlinks.
insert(prefix);
119 }
while (separatorPos != -1);
126 if (resolvingEntry) {
139 if (resolvingEntry) {
157 #if defined(QT_BUILD_CORE_LIB) 158 for (
int prefixSeparator = 0; prefixSeparator < filePath.
size(); ++prefixSeparator) {
159 QChar const ch = filePath[prefixSeparator];
164 if (prefixSeparator == 0) {
169 if (prefixSeparator == 1)
173 for (
int i = 0; i < paths.
count(); i++) {
191 #endif // defined(QT_BUILD_CORE_LIB) 232 QT_STATBUF statBuffer;
233 if (QT_FSTAT(fd, &statBuffer) == 0) {
241 #if defined(Q_OS_QNX) 242 static void fillStat64fromStat32(
struct stat64 *statBuf64,
const struct stat &statBuf32)
244 statBuf64->st_mode = statBuf32.
st_mode;
245 statBuf64->st_size = statBuf32.
st_size;
246 statBuf64->st_ctime = statBuf32.
st_ctime;
247 statBuf64->st_mtime = statBuf32.
st_mtime;
248 statBuf64->st_atime = statBuf32.
st_atime;
249 statBuf64->st_uid = statBuf32.st_uid;
250 statBuf64->st_gid = statBuf32.st_gid;
257 if (statBuffer.st_mode &
S_IRUSR)
259 if (statBuffer.st_mode &
S_IWUSR)
261 if (statBuffer.st_mode &
S_IXUSR)
264 if (statBuffer.st_mode &
S_IRGRP)
266 if (statBuffer.st_mode &
S_IWGRP)
268 if (statBuffer.st_mode &
S_IXGRP)
271 if (statBuffer.st_mode &
S_IROTH)
273 if (statBuffer.st_mode &
S_IWOTH)
275 if (statBuffer.st_mode &
S_IXOTH)
288 size_ = statBuffer.st_size;
289 #if !defined(QWS) && !defined(Q_WS_QPA) && defined(Q_OS_MAC) \ 290 && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 291 if (statBuffer.st_flags & UF_HIDDEN) {
299 modificationTime_ = qt_symbian_time_t_To_TTime(statBuffer.st_mtime);
301 creationTime_ = statBuffer.st_ctime ? statBuffer.st_ctime : statBuffer.st_mtime;
302 modificationTime_ = statBuffer.st_mtime;
303 accessTime_ = statBuffer.st_atime;
304 userId_ = statBuffer.st_uid;
305 groupId_ = statBuffer.st_gid;
311 #if defined(Q_OS_QNX) 314 for (dirent_extra *extra = _DEXTRA_FIRST(&entry); _DEXTRA_VALID(extra, &entry);
315 extra = _DEXTRA_NEXT(extra)) {
316 if (extra->d_type == _DTYPE_STAT || extra->d_type == _DTYPE_LSTAT) {
318 const struct dirent_extra_stat *
const extra_stat =
319 reinterpret_cast<struct dirent_extra_stat *
>(extra);
322 if (extra->d_type == _DTYPE_LSTAT) {
324 if (
S_ISLNK(extra_stat->d_stat.st_mode))
333 if (
S_ISLNK(extra_stat->d_stat.st_mode) && extra->d_type == _DTYPE_LSTAT)
336 #if defined(QT_USE_XOPEN_LFS_EXTENSIONS) && defined(QT_LARGEFILE_SUPPORT) 339 struct stat64 statBuf;
340 fillStat64fromStat32(&statBuf, extra_stat->d_stat);
341 fillFromStatBuf(statBuf);
343 fillFromStatBuf(extra_stat->d_stat);
346 if (!
S_ISLNK(extra_stat->d_stat.st_mode)) {
352 #elif defined(_DIRENT_HAVE_D_TYPE) || defined(Q_OS_BSD4) || defined(Q_OS_SYMBIAN) 356 switch (entry.d_type)
420 #if defined (Q_OS_SYMBIAN) 424 #elif defined(Q_OS_WIN) 437 #if defined (Q_OS_SYMBIAN) 441 #elif defined(Q_OS_WIN) static bool fillMetaData(const QFileSystemEntry &entry, QFileSystemMetaData &data, QFileSystemMetaData::MetaDataFlags what)
virtual FileFlags fileFlags(FileFlags type=FileInfoAll) const
This function should return the set of OR'd flags that are true for the file engine's file...
#define QT_END_NAMESPACE
This macro expands to.
const QChar at(int i) const
Returns the character at the given index position in the string.
static QString resolveGroupName(const QFileSystemEntry &entry, QFileSystemMetaData &data)
static void clear(QVariant::Private *d)
static bool _q_checkEntry(QFileSystemEntry &entry, QFileSystemMetaData &data, bool resolvingEntry)
int count(const T &t) const
Returns the number of occurrences of value in the list.
The QString class provides a Unicode character string.
The QChar class provides a 16-bit Unicode character.
QAbstractFileEngine * qt_custom_file_engine_handler_create(const QString &path)
#define QT_BEGIN_NAMESPACE
This macro expands to.
static QString resolveUserName(const QFileSystemEntry &entry, QFileSystemMetaData &data)
bool isDir() const
Returns true if this object points to a directory or to a symbolic link to a directory; otherwise ret...
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
bool contains(const T &value) const
int size() const
Returns the number of characters in this string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QString slowCanonicalized(const QString &path)
Returns the canonicalized form of path (i.
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
void setFile(const QString &file)
Sets the file that the QFileInfo provides information about to file.
The QAbstractFileEngine class provides an abstraction for accessing the filesystem.
const_iterator insert(const T &value)
static const char * data(const QByteArray &arr)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString cleanPath(const QString &path)
Removes all multiple directory separators "/" and resolves any "."s or ".."s found in the path...
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
QString & append(QChar c)
QString symLinkTarget() const
Returns the absolute path to the file or directory a symlink (or shortcut on Windows) points to...
static QStringList searchPaths(const QString &prefix)
static QString owner(const QFileSystemEntry &entry, QAbstractFileEngine::FileOwner own)
static QAbstractFileEngine * resolveEntryAndCreateLegacyEngine(QFileSystemEntry &entry, QFileSystemMetaData &data)
Resolves the entry (see QDir::searchPaths) and returns an engine for it, but never a QFSFileEngine...
bool isSymLink() const
Returns true if this object points to a symbolic link (or to a shortcut on Windows); otherwise return...
The QFileInfo class provides system-independent file information.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
QString absolutePath() const
Returns a file's path absolute path.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
static bool _q_resolveEntryAndCreateLegacyEngine_recursive(QFileSystemEntry &entry, QFileSystemMetaData &data, QAbstractFileEngine *&engine, bool resolvingEntry=false)