34 #if defined(_OS_WIN32_) 35 #if defined(_CC_BOOL_DEF_) 43 #if defined(_OS_OS2EMX_) 52 #if defined(Q_C_CALLBACKS) 56 extern int qt_cmp_si(
const void *,
const void * );
58 #if defined(Q_C_CALLBACKS) 64 DWORD len = GetEnvironmentVariableW( ( LPCWSTR ) qt_winTchar ( name,
TRUE ), NULL, 0 );
68 LPWSTR buf = (LPWSTR)
new WCHAR[ len ];
69 len = GetEnvironmentVariableW ( ( LPCWSTR ) qt_winTchar ( name,
TRUE ), buf, len );
75 QString ret = qt_winQString ( buf );
99 d = homeDrive + homePath;
128 #if defined(__CYGWIN32_) 131 return _wmkdir( ( LPCWSTR )
filePath( dirName, acceptAbsPath ).ucs2() ) == 0;
137 #if defined(__CYGWIN32_) 140 return _wrmdir( ( LPCWSTR )
filePath( dirName, acceptAbsPath ).ucs2() ) == 0;
147 if ( ( path[ 0 ] ==
'\\' ) || ( path[ 0 ] ==
'/' ) )
149 #if defined(__CYGWIN32_) 152 return ( _waccess( (
wchar_t*) path.
ucs2(), R_OK ) == 0 );
164 bool acceptAbsPaths )
167 #if defined(CHECK_NULL) 168 qWarning(
"QDir::rename: Empty or null file name(s)" );
174 #if defined(__CYGWIN32_) 178 return MoveFileW( ( LPCWSTR ) fn1.
ucs2(), ( LPCWSTR ) fn2.
ucs2() ) != 0;
184 #if defined(__CYGWIN32_) 191 return ( SetCurrentDirectoryW( ( LPCWSTR ) path.
ucs2() ) >= 0 );
199 #if defined(__CYGWIN32_) 202 if (
STAT(
".", &st ) == 0 ) {
208 qWarning(
"QDir::currentDirPath: getcwd() failed" );
212 qWarning(
"QDir::currentDirPath: stat(\".\") failed" );
220 size = ::GetCurrentDirectoryW(
PATH_MAX, currentName );
223 WCHAR * newCurrentName =
new WCHAR[
size ];
224 if ( ::GetCurrentDirectoryW(
PATH_MAX, newCurrentName ) != 0 )
226 delete [] newCurrentName;
232 if ( result.
length() >= 2 && result[ 1 ] ==
':' )
233 result[ 0 ] = result.
at( 0 ).
upper();
253 if ( path[ 0 ].isLetter() && path[ 1 ] ==
':' )
255 return ( ( path[ p ] !=
'/' ) && ( path[
p ] !=
'\\' ) );
267 #if defined(_OS_WIN32_) 268 #define IS_SUBDIR FILE_ATTRIBUTE_DIRECTORY 269 #define IS_RDONLY FILE_ATTRIBUTE_READONLY 270 #define IS_ARCH FILE_ATTRIBUTE_ARCHIVE 271 #define IS_HIDDEN FILE_ATTRIBUTE_HIDDEN 272 #define IS_SYSTEM FILE_ATTRIBUTE_SYSTEM 273 #define FF_GETFIRST FindFirstFile 274 #define FF_GETNEXT FindNextFile 275 #define FF_ERROR INVALID_HANDLE_VALUE 277 #define IS_SUBDIR _A_SUBDIR 278 #define IS_RDONLY _A_RDONLY 279 #define IS_ARCH _A_ARCH 280 #define IS_HIDDEN _A_HIDDEN 281 #define IS_SYSTEM _A_SYSTEM 282 #define FF_GETFIRST _findfirst 283 #define FF_GETNEXT _findnext 289 int filterSpec,
int sortSpec )
305 bool doDirs = (filterSpec &
Dirs) != 0;
306 bool doFiles = (filterSpec &
Files) != 0;
307 bool noSymLinks = (filterSpec &
NoSymLinks) != 0;
308 bool doReadable = (filterSpec &
Readable) != 0;
309 bool doWritable = (filterSpec &
Writable) != 0;
310 bool doExecable = (filterSpec &
Executable) != 0;
311 bool doHidden = (filterSpec &
Hidden) != 0;
313 if ( !doHidden && !nameFilter.
isEmpty() && nameFilter[0] ==
'.' )
315 bool doModified = (filterSpec &
Modified) != 0;
316 bool doSystem = (filterSpec &
System) != 0;
322 #if defined(_OS_WIN32_) 324 WIN32_FIND_DATAW finfo;
332 #if defined(CHECK_NULL) 333 warning(
"QDir::readDirEntries: No directory name specified" );
337 if ( p.
at(plen-1) !=
'/' && p.
at(plen-1) !=
'\\' )
341 #if defined(__CYGWIN32_) 344 ff = FindFirstFileW ( ( LPCWSTR ) p.
ucs2(), &finfo );
349 warning(
"QDir::readDirEntries: Cannot read the directory: %s",
361 #if defined(__CYGWIN32_) 367 if (!FindNextFileW(ff, &finfo ))
371 #if defined(__CYGWIN32_) 372 int attrib = finfo.attrib;
374 int attrib = finfo.dwFileAttributes;
377 bool isFile = !isDir;
378 bool isSymLink =
FALSE;
380 bool isWritable = (attrib &
IS_RDONLY) == 0;
381 bool isExecable =
FALSE;
382 bool isModified = (attrib &
IS_ARCH) != 0;
383 bool isHidden = (attrib &
IS_HIDDEN) != 0;
384 bool isSystem = (attrib &
IS_SYSTEM) != 0;
386 #if defined(__CYGWIN32_) 387 const char *
fname = finfo.name;
399 if ( ext ==
".exe" || ext ==
".com" || ext ==
".bat" ||
400 ext ==
".pif" || ext ==
".cmd" )
404 if ( (doDirs && isDir) || (doFiles && isFile) )
406 if ( noSymLinks && isSymLink )
408 if ( (filterSpec &
RWEMask) != 0 )
409 if ( (doReadable && !isReadable) ||
410 (doWritable && !isWritable) ||
411 (doExecable && !isExecable) )
413 if ( doModified && !isModified )
415 if ( !doHidden && isHidden )
417 if ( !doSystem && isSystem )
423 #if defined(__CYGWIN32_) 436 qsort( si, i,
sizeof(si[0]),
qt_cmp_si );
441 for ( j=0; j<i; j++ ) {
462 if ( !knownMemoryLeak ) {
465 #if defined(_OS_WIN32_) 467 #elif defined(_OS_OS2EMX_) 469 if (DosQueryCurrentDisk(&cur,&driveBits) != NO_ERROR)
471 driveBits &= 0x3ffffff;
479 driveBits = driveBits >> 1;
483 return knownMemoryLeak;
static void slashify(QString &)
QString nameFilter() const
Iterator append(const T &x)
The QRegExp class provides pattern matching using regular expressions or wildcards.
static QString homeDirPath()
static const QFileInfoList * drives()
virtual QString dirName() const
QStringList qt_makeFilterList(const QString &filter)
static bool isRelativePath(const QString &path)
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
void qWarning(const char *msg,...)
virtual bool isRoot() const
static QString fromLatin1(const char *, int len=-1)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
QInternalList< QFileInfo > QFileInfoList
const char * data() const
virtual bool mkdir(const QString &dirName, bool acceptAbsPath=TRUE) const
void setFile(const QString &file)
virtual bool rename(const QString &name, const QString &newName, bool acceptAbsPaths=TRUE)
virtual bool readDirEntries(const QString &nameFilter, int FilterSpec, int SortSpec)
static QString currentDirPath()
const unsigned short * ucs2() const
static QString rootDirPath()
void append(const type *d)
virtual QString canonicalPath() const
static QCString encodeName(const QString &fileName)
static QString fromUcs2(const unsigned short *ucs2)
static QString decodeName(const QCString &localFileName)
void setAutoDelete(bool enable)
virtual bool rmdir(const QString &dirName, bool acceptAbsPath=TRUE) const
virtual QString path() const
Q_EXPORT char * qstrcpy(char *dst, const char *src)
static QString p_getenv(QString name)
virtual QString filePath(const QString &fileName, bool acceptAbsPath=TRUE) const
The QFileInfo class provides system-independent file information.
def filters(nticks=9600, tick=0.5 *units.us, npitches=3000, pitch=1.0)
virtual bool exists() const
QString right(uint len) const
static bool setCurrent(const QString &path)
int qt_cmp_si(const void *, const void *)
virtual bool isReadable() const