6#include "qplatformdefs.h"
12#include <QtCore/qoperatingsystemversion.h>
13#include <QtCore/private/qcore_unix_p.h>
14#include <QtCore/private/qfiledevice_p.h>
15#include <QtCore/qvarlengtharray.h>
16#ifndef QT_BOOTSTRAPPED
17# include <QtCore/qstandardpaths.h>
29#if __has_include(<paths.h>)
33# define _PATH_TMP "/tmp"
36#if defined(Q_OS_DARWIN)
37# include <QtCore/private/qcore_mac_p.h>
38# include <CoreFoundation/CFBundle.h>
42#include <CoreServices/CoreServices.h>
45#if defined(QT_PLATFORM_UIKIT)
46#include <MobileCoreServices/MobileCoreServices.h>
49#if defined(Q_OS_DARWIN)
50# include <sys/clonefile.h>
55extern "C" NSString *NSTemporaryDirectory();
58#if defined(Q_OS_LINUX)
59# include <sys/ioctl.h>
60# include <sys/sendfile.h>
65# define FICLONE _IOW(0x94, 9, int)
69#if defined(Q_OS_ANDROID)
73# undef STATX_BASIC_STATS
94#if defined(Q_OS_DARWIN)
99 QCFString path = CFStringCreateWithFileSystemRepresentation(0,
100 entry.nativeFilePath().constData());
110 if (CFURLCopyResourcePropertyForKey(
url,
key, &
value, NULL)) {
111 if (
value == kCFBooleanTrue)
120 if (!
data.isDirectory())
126 if (suffix.
length() > 0) {
129 QCFType<CFStringRef> uniformTypeIdentifier = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extensionRef, NULL);
130 if (UTTypeConformsTo(uniformTypeIdentifier, kUTTypeBundle))
145 kLSRolesEditor | kLSRolesViewer,
nullptr);
149 CFStringRef identifier = CFBundleGetIdentifier(
bundle);
150 QString applicationId = QString::fromCFString(identifier);
151 if (applicationId !=
"com.apple.finder"_L1)
158 return hasResourcePropertyFlag(
data,
entry, kCFURLIsPackageKey);
166 using namespace std::chrono;
167 return milliseconds{seconds{
t}}.count();
171[[maybe_unused]]
qint64 atime(
const QT_STATBUF &statBuffer,
ulong)
173 return time_t_toMsecs(statBuffer.st_atime);
175[[maybe_unused]]
qint64 birthtime(
const QT_STATBUF &,
ulong)
179[[maybe_unused]]
qint64 ctime(
const QT_STATBUF &statBuffer,
ulong)
181 return time_t_toMsecs(statBuffer.st_ctime);
183[[maybe_unused]]
qint64 mtime(
const QT_STATBUF &statBuffer,
ulong)
185 return time_t_toMsecs(statBuffer.st_mtime);
191qint64 timespecToMSecs(
const T &spec)
193 using namespace std::chrono;
194 const nanoseconds nsecs = seconds{spec.tv_sec} + nanoseconds{spec.tv_nsec};
195 return duration_cast<milliseconds>(nsecs).count();
200[[maybe_unused]]
static typename std::enable_if<(&T::st_atim,
true),
qint64>
::type
201atime(
const T &statBuffer,
int)
202{
return timespecToMSecs(statBuffer.st_atim); }
205[[maybe_unused]]
static typename std::enable_if<(&T::st_birthtim,
true),
qint64>
::type
206birthtime(
const T &statBuffer,
int)
207{
return timespecToMSecs(statBuffer.st_birthtim); }
210[[maybe_unused]]
static typename std::enable_if<(&T::st_ctim,
true),
qint64>
::type
211ctime(
const T &statBuffer,
int)
212{
return timespecToMSecs(statBuffer.st_ctim); }
215[[maybe_unused]]
static typename std::enable_if<(&T::st_mtim,
true),
qint64>
::type
216mtime(
const T &statBuffer,
int)
217{
return timespecToMSecs(statBuffer.st_mtim); }
222[[maybe_unused]]
static typename std::enable_if<(&T::st_atimespec,
true),
qint64>
::type
223atime(
const T &statBuffer,
int)
224{
return timespecToMSecs(statBuffer.st_atimespec); }
227[[maybe_unused]]
static typename std::enable_if<(&T::st_birthtimespec,
true),
qint64>
::type
228birthtime(
const T &statBuffer,
int)
229{
return timespecToMSecs(statBuffer.st_birthtimespec); }
232[[maybe_unused]]
static typename std::enable_if<(&T::st_ctimespec,
true),
qint64>
::type
233ctime(
const T &statBuffer,
int)
234{
return timespecToMSecs(statBuffer.st_ctimespec); }
237[[maybe_unused]]
static typename std::enable_if<(&T::st_mtimespec,
true),
qint64>
::type
238mtime(
const T &statBuffer,
int)
239{
return timespecToMSecs(statBuffer.st_mtimespec); }
242#if !defined(st_mtimensec) && !defined(__alpha__)
245[[maybe_unused]]
static typename std::enable_if<(&T::st_atimensec,
true),
qint64>
::type
246atime(
const T &statBuffer,
int)
247{
return statBuffer.st_atime *
Q_INT64_C(1000) + statBuffer.st_atimensec / 1000000; }
250[[maybe_unused]]
static typename std::enable_if<(&T::st_birthtimensec,
true),
qint64>
::type
251birthtime(
const T &statBuffer,
int)
252{
return statBuffer.st_birthtime *
Q_INT64_C(1000) + statBuffer.st_birthtimensec / 1000000; }
255[[maybe_unused]]
static typename std::enable_if<(&T::st_ctimensec,
true),
qint64>
::type
256ctime(
const T &statBuffer,
int)
257{
return statBuffer.st_ctime *
Q_INT64_C(1000) + statBuffer.st_ctimensec / 1000000; }
260[[maybe_unused]]
static typename std::enable_if<(&T::st_mtimensec,
true),
qint64>
::type
261mtime(
const T &statBuffer,
int)
262{
return statBuffer.st_mtime *
Q_INT64_C(1000) + statBuffer.st_mtimensec / 1000000; }
267#ifdef STATX_BASIC_STATS
268static int qt_real_statx(
int fd,
const char *pathname,
int flags,
struct statx *statxBuffer)
270 unsigned mask = STATX_BASIC_STATS | STATX_BTIME;
272 return ret == -1 ? -errno : 0;
275static int qt_statx(
const char *pathname,
struct statx *statxBuffer)
277 return qt_real_statx(AT_FDCWD, pathname, 0, statxBuffer);
280static int qt_lstatx(
const char *pathname,
struct statx *statxBuffer)
282 return qt_real_statx(AT_FDCWD, pathname, AT_SYMLINK_NOFOLLOW, statxBuffer);
287 return qt_real_statx(
fd,
"", AT_EMPTY_PATH, statxBuffer);
290inline void QFileSystemMetaData::fillFromStatxBuf(
const struct statx &statxBuffer)
317 if ((statxBuffer.
stx_mode & S_IFMT) == S_IFREG)
319 else if ((statxBuffer.
stx_mode & S_IFMT) == S_IFDIR)
321 else if ((statxBuffer.
stx_mode & S_IFMT) != S_IFBLK)
326 if (statxBuffer.stx_nlink == 0)
328 size_ =
qint64(statxBuffer.stx_size);
332 accessTime_ = timespecToMSecs(statxBuffer.stx_atime);
333 metadataChangeTime_ = timespecToMSecs(statxBuffer.stx_ctime);
334 modificationTime_ = timespecToMSecs(statxBuffer.stx_mtime);
335 const bool birthMask = statxBuffer.stx_mask & STATX_BTIME;
336 birthTime_ = birthMask ? timespecToMSecs(statxBuffer.stx_btime) : 0;
338 userId_ = statxBuffer.stx_uid;
339 groupId_ = statxBuffer.stx_gid;
351inline void QFileSystemMetaData::fillFromStatxBuf(
const struct statx &)
361 struct statx statxBuffer;
364 if (
ret != -ENOSYS) {
366 data.fillFromStatxBuf(statxBuffer);
372 QT_STATBUF statBuffer;
374 if (QT_FSTAT(
fd, &statBuffer) == 0) {
375 data.fillFromStatBuf(statBuffer);
382#if defined(_DEXTRA_FIRST)
383static void fillStat64fromStat32(
struct stat64 *statBuf64,
const struct stat &statBuf32)
385 statBuf64->st_mode = statBuf32.st_mode;
386 statBuf64->st_size = statBuf32.st_size;
387#if _POSIX_VERSION >= 200809L
388 statBuf64->st_ctim = statBuf32.st_ctim;
389 statBuf64->st_mtim = statBuf32.st_mtim;
390 statBuf64->st_atim = statBuf32.st_atim;
392 statBuf64->st_ctime = statBuf32.st_ctime;
393 statBuf64->st_mtime = statBuf32.st_mtime;
394 statBuf64->st_atime = statBuf32.st_atime;
396 statBuf64->st_uid = statBuf32.st_uid;
397 statBuf64->st_gid = statBuf32.st_gid;
401void QFileSystemMetaData::fillFromStatBuf(
const QT_STATBUF &statBuffer)
404 if (statBuffer.st_mode & S_IRUSR)
406 if (statBuffer.st_mode & S_IWUSR)
408 if (statBuffer.st_mode & S_IXUSR)
411 if (statBuffer.st_mode & S_IRGRP)
413 if (statBuffer.st_mode & S_IWGRP)
415 if (statBuffer.st_mode & S_IXGRP)
418 if (statBuffer.st_mode & S_IROTH)
420 if (statBuffer.st_mode & S_IWOTH)
422 if (statBuffer.st_mode & S_IXOTH)
426 if ((statBuffer.st_mode & S_IFMT) == S_IFREG)
428 else if ((statBuffer.st_mode & S_IFMT) == S_IFDIR)
430 else if ((statBuffer.st_mode & S_IFMT) != S_IFBLK)
435 if (statBuffer.st_nlink == 0)
437 size_ = statBuffer.st_size;
439 if (statBuffer.st_flags & UF_HIDDEN) {
446 accessTime_ = GetFileTimes::atime(statBuffer, 0);
447 birthTime_ = GetFileTimes::birthtime(statBuffer, 0);
448 metadataChangeTime_ = GetFileTimes::ctime(statBuffer, 0);
449 modificationTime_ = GetFileTimes::mtime(statBuffer, 0);
451 userId_ = statBuffer.st_uid;
452 groupId_ = statBuffer.st_gid;
455void QFileSystemMetaData::fillFromDirEnt(
const QT_DIRENT &
entry)
457#if defined(_DEXTRA_FIRST)
460 for (dirent_extra *extra = _DEXTRA_FIRST(&
entry); _DEXTRA_VALID(extra, &
entry);
461 extra = _DEXTRA_NEXT(extra)) {
462 if (extra->d_type == _DTYPE_STAT || extra->d_type == _DTYPE_LSTAT) {
464 const struct dirent_extra_stat *
const extra_stat =
465 reinterpret_cast<struct dirent_extra_stat *
>(extra);
468 if (extra->d_type == _DTYPE_LSTAT) {
470 if (S_ISLNK(extra_stat->d_stat.st_mode))
479 if (S_ISLNK(extra_stat->d_stat.st_mode) && extra->d_type == _DTYPE_LSTAT)
482#if defined(QT_USE_XOPEN_LFS_EXTENSIONS) && defined(QT_LARGEFILE_SUPPORT)
485 struct stat64 statBuf;
486 fillStat64fromStat32(&statBuf, extra_stat->d_stat);
487 fillFromStatBuf(statBuf);
489 fillFromStatBuf(extra_stat->d_stat);
492 if (!S_ISLNK(extra_stat->d_stat.st_mode)) {
498#elif defined(_DIRENT_HAVE_D_TYPE) || defined(Q_OS_BSD4)
502 switch (
entry.d_type)
583 if (
data.isDirectory() &&
s[0] !=
'/') {
587 if (!
ret.isEmpty() && !
ret.endsWith(u
'/'))
592 if (!
ret.startsWith(u
'/'))
595 if (
ret.size() > 1 &&
ret.endsWith(u
'/'))
599#if defined(Q_OS_DARWIN)
601 QCFString path = CFStringCreateWithFileSystemRepresentation(0,
617 (CFURLBookmarkResolutionOptions)(kCFBookmarkResolutionWithoutUIMask
618 | kCFBookmarkResolutionWithoutMountingMask), NULL, NULL, NULL, NULL);
647#if !defined(Q_OS_DARWIN) && !defined(Q_OS_QNX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_HAIKU) && _POSIX_VERSION < 200809L
652# if defined(Q_OS_DARWIN) || defined(Q_OS_ANDROID) || _POSIX_VERSION < 200801L
657 std::nullptr_t stack_result =
nullptr;
659 auto resolved_path_deleter = [&](
char *
ptr) {
661# if defined(Q_OS_DARWIN) || defined(Q_OS_ANDROID) || _POSIX_VERSION < 200801L
669 std::unique_ptr<char,
decltype (resolved_path_deleter)> resolved_name {
nullptr, resolved_path_deleter};
670# if defined(Q_OS_DARWIN) || defined(Q_OS_ANDROID)
679 resolved_name.reset(realpath(
entry.nativeFilePath().constData(), stack_result));
681 resolved_name.reset(realpath(
entry.nativeFilePath().constData(), stack_result));
688 }
else if (errno == ENOENT || errno == ENOTDIR) {
711 if (!orig.
isEmpty() && !(orig.
size() == 1 && orig[0] ==
'.')) {
719 const bool isDir =
result.endsWith(
'/');
728 stringVersion.
append(u
'/');
737 QT_STATBUF statResult;
738 if (QT_STAT(
entry.nativeFilePath().constData(), &statResult)) {
752 QT_STATBUF statResult;
753 if (QT_FSTAT(
fd, &statResult)) {
766#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
767 long size_max = sysconf(_SC_GETPW_R_SIZE_MAX);
773#if !defined(Q_OS_INTEGRITY) && !defined(Q_OS_WASM)
774 struct passwd *pw =
nullptr;
775#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS)
777 getpwuid_r(userId, &
entry,
buf.data(),
buf.size(), &pw);
779 pw = getpwuid(userId);
792#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
793 long size_max = sysconf(_SC_GETPW_R_SIZE_MAX);
799#if !defined(Q_OS_INTEGRITY) && !defined(Q_OS_WASM)
800 struct group *gr =
nullptr;
801#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID) && (__ANDROID_API__ >= 24))
802 size_max = sysconf(_SC_GETGR_R_SIZE_MAX);
805 buf.resize(size_max);
813 if (!getgrgid_r(groupId, &
entry,
buf.data(),
buf.size(), &gr)
818 gr = getgrgid(groupId);
828#if defined(Q_OS_DARWIN)
833 kCFURLPOSIXPathStyle,
true);
835 if (CFTypeRef
name = (CFTypeRef)CFDictionaryGetValue(dict, kCFBundleNameKey)) {
836 if (CFGetTypeID(
name) == CFStringGetTypeID())
837 return QString::fromCFString((CFStringRef)
name);
846 QFileSystemMetaData::MetaDataFlags what)
850#if defined(Q_OS_DARWIN)
869 data.entryFlags &= ~what;
888 QT_STATBUF statBuffer;
889 struct statx statxBuffer;
894 statResult =
qt_lstatx(nativeFilePath, &statxBuffer);
895 if (statResult == -ENOSYS) {
897 statResult = QT_LSTAT(nativeFilePath, &statBuffer);
899 mode = statBuffer.st_mode;
900 }
else if (statResult == 0) {
905 if (statResult >= 0) {
913 data.fillFromStatxBuf(statxBuffer);
915 data.fillFromStatBuf(statBuffer);
931 if (entryErrno == 0 && statResult == -1) {
933 statResult =
qt_statx(nativeFilePath, &statxBuffer);
934 if (statResult == -ENOSYS) {
936 statResult = QT_STAT(nativeFilePath, &statBuffer);
938 data.fillFromStatBuf(statBuffer);
939 }
else if (statResult == 0) {
940 data.fillFromStatxBuf(statxBuffer);
944 if (statResult != 0) {
947 data.metadataChangeTime_ = 0;
948 data.modificationTime_ = 0;
949 data.accessTime_ = 0;
964 if (entryErrno != 0 || (what & flag) == 0)
966 if (QT_ACCESS(nativeFilePath,
mode) == 0) {
969 }
else if (errno != EACCES && errno != EROFS) {
980 if (QT_ACCESS(nativeFilePath, F_OK) == -1)
990#if defined(Q_OS_DARWIN)
992 if (entryErrno == 0 && hasResourcePropertyFlag(
data,
entry, kCFURLIsAliasFileKey)) {
1001 if (entryErrno == 0 && isPackage(
data,
entry))
1009 && !
data.isHidden()) {
1012#
if defined(Q_OS_DARWIN)
1013 || (entryErrno == 0 && hasResourcePropertyFlag(
data,
entry, kCFURLIsHiddenKey))
1020 if (entryErrno != 0) {
1029bool QFileSystemEngine::cloneFile(
int srcfd,
int dstfd,
const QFileSystemMetaData &knownData)
1031 QT_STATBUF statBuffer;
1034 statBuffer.st_mode = S_IFREG;
1038 }
else if (QT_FSTAT(srcfd, &statBuffer) == -1) {
1040 }
else if (!S_ISREG((statBuffer.st_mode))) {
1045#if defined(Q_OS_LINUX)
1047 if (::ioctl(dstfd, FICLONE, srcfd) == 0)
1052 const size_t SendfileSize = 0x7ffff000;
1054 ssize_t
n = ::sendfile(dstfd, srcfd,
nullptr, SendfileSize);
1061 n = ::sendfile(dstfd, srcfd,
nullptr, SendfileSize);
1067 n = ftruncate(dstfd, 0);
1068 n = lseek(srcfd, 0, SEEK_SET);
1069 n = lseek(dstfd, 0, SEEK_SET);
1075#elif defined(Q_OS_DARWIN)
1077 return fcopyfile(srcfd, dstfd,
nullptr, COPYFILE_DATA | COPYFILE_STAT) == 0;
1087 bool shouldMkdirFirst =
true)
1092 const auto isDir = [](
const QByteArray &nativeName) {
1094 return QT_STAT(nativeName.
constData(), &st) == 0 && (st.st_mode & S_IFMT) == S_IFDIR;
1097 if (shouldMkdirFirst && QT_MKDIR(nativeName,
mode) == 0)
1099 if (errno == EISDIR)
1101 if (errno == EEXIST)
1102 return isDir(nativeName);
1103 if (errno != ENOENT)
1116 if (QT_MKDIR(nativeName,
mode) == 0)
1118 return errno == EEXIST && isDir(nativeName);
1123 std::optional<QFile::Permissions> permissions)
1134 mode_t
mode = permissions ? QtPrivate::toMode_t(*permissions) : 0777;
1135 if (QT_MKDIR(nativeName,
mode) == 0)
1148 if (removeEmptyParents) {
1150 for (
qsizetype oldslash = 0, slash=dirName.
size(); slash > 0; oldslash = slash) {
1153 if (QT_STAT(chunk.
constData(), &st) != -1) {
1154 if ((st.st_mode & S_IFMT) != S_IFDIR)
1157 return oldslash != 0;
1174 if (::symlink(
source.nativeFilePath().constData(),
target.nativeFilePath().constData()) == 0)
1186#ifndef QT_BOOTSTRAPPED
1195 if (topDir.
mkdir(trashDir))
1201 auto isSticky = [](
const QFileInfo &fileInfo) ->
bool {
1204 return st.st_mode & S_ISVTX;
1213 if (sourceStorage != homeStorage) {
1214 const auto dotTrash =
".Trash"_L1;
1227 if (topDir.
cd(dotTrash)) {
1233 qCritical(
"Warning: '%s' is a symlink to '%s'",
1236 }
else if (!isSticky(trashInfo)) {
1238 qCritical(
"Warning: '%s' doesn't have sticky bit set!",
1240 }
else if (trashInfo.
isDir()) {
1250 trash = makeTrashDir(topDir, userID);
1262 const QString userTrashDir = dotTrash + u
'-' + userID;
1263 trash = makeTrashDir(topDir, userTrashDir);
1278 trash = makeTrashDir(topDir,
"Trash"_L1);
1280 qWarning(
"Unable to establish trash directory in %s",
1293#ifdef QT_BOOTSTRAPPED
1300 if (!sourceInfo.exists()) {
1304 const QString sourcePath = sourceInfo.absoluteFilePath();
1307 if (!trashDir.exists())
1312 const auto filesDir =
"files"_L1;
1313 const auto infoDir =
"info"_L1;
1314 trashDir.mkdir(filesDir);
1315 int savedErrno = errno;
1316 trashDir.mkdir(infoDir);
1319 if (!trashDir.exists(filesDir) || !trashDir.exists(infoDir)) {
1330 const QString trashedName = sourceInfo.isDir()
1332 : sourceInfo.fileName();
1333 QString uniqueTrashedName = u
'/' + trashedName;
1337 auto makeUniqueTrashedName = [trashedName, &
counter]() ->
QString {
1341 while (
QFile::exists(trashDir.filePath(filesDir) + uniqueTrashedName))
1342 uniqueTrashedName = makeUniqueTrashedName();
1355 infoFileName = trashDir.filePath(infoDir)
1356 + uniqueTrashedName +
".trashinfo"_L1;
1359 uniqueTrashedName = makeUniqueTrashedName();
1360 }
while (!infoFile.
isOpen());
1362 const QString targetPath = trashDir.filePath(filesDir) + uniqueTrashedName;
1368 infoPath = sourcePath.
mid(storageInfo.rootPath().length());
1369 if (infoPath.
front() == u
'/')
1370 infoPath = infoPath.
mid(1);
1372 infoPath = sourcePath;
1403#if defined(Q_OS_DARWIN)
1404 if (::clonefile(
source.nativeFilePath().constData(),
1405 target.nativeFilePath().constData(), 0) == 0)
1426#if defined(RENAME_NOREPLACE) && QT_CONFIG(renameat2)
1427 if (renameat2(AT_FDCWD,
srcPath, AT_FDCWD, tgtPath, RENAME_NOREPLACE) == 0)
1431 if (errno != EINVAL) {
1436#if defined(Q_OS_DARWIN) && defined(RENAME_EXCL)
1437 if (renameatx_np(AT_FDCWD,
srcPath, AT_FDCWD, tgtPath, RENAME_EXCL) == 0)
1439 if (errno != ENOTSUP) {
1452 int savedErrno = errno;
1481 if (::rename(
srcPath, tgtPath) == 0)
1495 if (::rename(
source.nativeFilePath().constData(),
target.nativeFilePath().constData()) == 0)
1505 if (unlink(
entry.nativeFilePath().constData()) == 0)
1517 mode_t
mode = QtPrivate::toMode_t(permissions);
1518 bool success = ::chmod(
entry.nativeFilePath().constData(),
mode) == 0;
1519 if (success &&
data) {
1532 mode_t
mode = QtPrivate::toMode_t(permissions);
1534 bool success = ::fchmod(
fd,
mode) == 0;
1535 if (success &&
data) {
1554#if QT_CONFIG(futimens)
1556 struct timespec ts[2] = {{0, UTIME_OMIT}, {0, UTIME_OMIT}};
1564 if (futimens(
fd, ts) == -1) {
1592#ifdef QT_UNIX_TEMP_PATH_OVERRIDE
1593 return QT_UNIX_TEMP_PATH_OVERRIDE
""_L1;
1598#if defined(Q_OS_DARWIN) && !defined(QT_BOOTSTRAPPED)
1599 }
else if (NSString *nsPath = NSTemporaryDirectory()) {
1600 temp = QString::fromCFString((CFStringRef)nsPath);
1613 r = QT_CHDIR(
path.nativeFilePath().constData());
1620#if defined(__GLIBC__) && !defined(PATH_MAX)
1621 char *currentName = ::get_current_dir_name();
1624 ::free(currentName);
1628 if (::getcwd(currentName,
PATH_MAX)) {
1629#if defined(Q_OS_VXWORKS) && defined(VXWORKS_VXSIM)
1638# if defined(QT_DEBUG)
1640 qWarning(
"QFileSystemEngine::currentPath: getcwd() failed");
FileTime
These are used by the fileTime() function.
char * data()
\macro QT_NO_CAST_FROM_BYTEARRAY
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
bool startsWith(QByteArrayView bv) const
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
static QByteArray number(int, int base=10)
Returns a byte-array representing the whole number n as text.
QByteArray left(qsizetype len) const
Returns a byte array that contains the first len bytes of this byte array.
qsizetype lastIndexOf(char c, qsizetype from=-1) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QByteArray & append(char c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
\inmodule QtCore\reentrant
static QDateTime currentDateTime()
This is an overloaded member function, provided for convenience. It differs from the above function o...
qint64 toMSecsSinceEpoch() const
bool isValid() const
Returns true if this datetime represents a definite moment, otherwise false.
bool mkdir(const QString &dirName) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString dirName() const
Returns the name of the directory; this is not the same as the path, e.g.
QString path() const
Returns the path.
bool cd(const QString &dirName)
Changes the QDir's directory to dirName.
QString canonicalPath() const
Returns the canonical path, i.e.
static QChar separator()
Returns the native directory separator: "/" under Unix and "\\" under Windows.
QString filePath(const QString &fileName) const
Returns the path name of a file in the directory.
static QDir home()
Returns the user's home directory.
static QString cleanPath(const QString &path)
Returns path with directory separators normalized (that is, platform-native separators converted to "...
void close() override
Calls QFileDevice::flush() and closes the file.
\inmodule QtCore \reentrant
bool isSymLink() const
Returns true if this object points to a symbolic link, shortcut, or alias; otherwise returns false.
QString symLinkTarget() const
QString suffix() const
Returns the suffix (extension) of the file.
QString absoluteFilePath() const
Returns an absolute path including the file name.
bool isDir() const
Returns true if this object points to a directory or to a symbolic link to a directory.
static bool setFileTime(const QFileSystemEntry &entry, const QDateTime &newDate, QAbstractFileEngine::FileTime whatTime, QSystemError &error)
static QFileSystemEntry getLinkTarget(const QFileSystemEntry &link, QFileSystemMetaData &data)
static QFileSystemEntry canonicalName(const QFileSystemEntry &entry, QFileSystemMetaData &data)
static QByteArray id(const QFileSystemEntry &entry)
static bool setCurrentPath(const QFileSystemEntry &entry)
static bool moveFileToTrash(const QFileSystemEntry &source, QFileSystemEntry &newLocation, QSystemError &error)
static QFileSystemEntry getRawLinkPath(const QFileSystemEntry &link, QFileSystemMetaData &data)
static bool copyFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error)
static bool renameOverwriteFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error)
static bool fillMetaData(const QFileSystemEntry &entry, QFileSystemMetaData &data, QFileSystemMetaData::MetaDataFlags what)
static QString rootPath()
static bool createDirectory(const QFileSystemEntry &entry, bool createParents, std::optional< QFile::Permissions > permissions=std::nullopt)
static QString bundleName(const QFileSystemEntry &)
static bool createLink(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error)
static bool setPermissions(const QFileSystemEntry &entry, QFile::Permissions permissions, QSystemError &error, QFileSystemMetaData *data=nullptr)
static QString homePath()
static bool renameFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error)
static QFileSystemEntry absoluteName(const QFileSystemEntry &entry)
static QString tempPath()
static QString resolveUserName(const QFileSystemEntry &entry, QFileSystemMetaData &data)
static QString resolveGroupName(const QFileSystemEntry &entry, QFileSystemMetaData &data)
static bool removeFile(const QFileSystemEntry &entry, QSystemError &error)
static bool removeDirectory(const QFileSystemEntry &entry, bool removeEmptyParents)
static QFileSystemEntry currentPath()
Q_AUTOTEST_EXPORT NativePath nativeFilePath() const
Q_AUTOTEST_EXPORT QString filePath() const
bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
bool setPermissions(Permissions permissionSpec) override
Sets the permissions for the file to the permissions specified.
bool remove()
Removes the file specified by fileName().
static QByteArray encodeName(const QString &fileName)
Converts fileName to an 8-bit encoding that you can use in native APIs.
void setFileName(const QString &name)
Sets the name of the file.
static QString decodeName(const QByteArray &localFileName)
This does the reverse of QFile::encodeName() using localFileName.
bool exists() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isOpen() const
Returns true if the device is open; otherwise returns false.
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
static QString writableLocation(StandardLocation type)
QString rootPath() const
Returns the mount point of the filesystem this QStorageInfo object represents.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QByteArray toLatin1() const &
qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
void chop(qsizetype n)
Removes n characters from the end of the string.
const QChar * constData() const
Returns a pointer to the data stored in the QString.
qsizetype size() const
Returns the number of characters in this string.
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QByteArray toLocal8Bit() const &
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString & append(QChar c)
QString left(qsizetype n) const
Returns a substring that contains the n leftmost characters of the string.
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString & remove(qsizetype i, qsizetype len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
static QString static QString asprintf(const char *format,...) Q_ATTRIBUTE_FORMAT_PRINTF(1
qsizetype length() const
Returns the number of characters in this string.
static QByteArray toPercentEncoding(const QString &, const QByteArray &exclude=QByteArray(), const QByteArray &include=QByteArray())
Returns an encoded copy of input.
void qErrnoWarning(const char *msg,...)
Combined button and popup list for selecting options.
Q_CORE_EXPORT char * qstrncpy(char *dst, const char *src, size_t len)
QT_BEGIN_NAMESPACE QByteArray qt_readlink(const char *path)
timespec durationToTimespec(std::chrono::nanoseconds timeout) noexcept
#define Q_FORWARD_DECLARE_OBJC_CLASS(classname)
DBusConnection const char DBusError * error
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_CHECK_FILE_NAME(name, result)
static int qt_lstatx(const char *, struct statx *)
static int qt_fstatx(int, struct statx *)
static bool createDirectoryWithParents(const QByteArray &nativeName, mode_t mode, bool shouldMkdirFirst=true)
static QString freeDesktopTrashLocation(const QString &sourcePath)
static int qt_statx(const char *, struct statx *)
static ControlElement< T > * ptr(QWidget *widget)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei const GLchar * buf
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLsizei GLsizei GLchar * source
GLsizei const GLchar *const * path
static QUrl resolvedUrl(const QUrl &url, const QQmlRefPointer< QQmlContextData > &context)
static QString canonicalPath(const QString &rootPath)
#define qUtf16Printable(string)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
unsigned long long quint64
QFileInfo info(fileName)
[8]
QUrl url("example.com")
[constructor-url-reference]
QItemEditorCreatorBase * creator
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent