- Timestamp:
- Mar 5, 2013, 11:30:56 PM (12 years ago)
- Location:
- trunk/src/corelib/io
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/corelib/io/qfsfileengine_iterator_os2.cpp
r1116 r1117 52 52 #include <QtCore/qvariant.h> 53 53 54 #include <unistd.h> 54 55 #ifndef QT_OS2_USE_DOSFINDFIRST 55 56 #include <dirent.h> 56 #include <unistd.h>57 57 #else 58 58 #include <QtCore/qdatetime.h> … … 360 360 } 361 361 362 // we have to use stat() to see if it's a kLIBC-like symlink 363 QByteArray fn = QFile::encodeName(fileName); 364 QT_STATBUF st; 365 if ((QT_LSTAT(fn.constData(), &st) == 0) && S_ISLNK(st.st_mode)) 366 { 367 char buf[PATH_MAX]; 368 if (realpath(fn.constData(), buf) != NULL) 369 { 370 d_ptr->fileFlags |= QAbstractFileEngine::LinkType; 371 // query the real file instead of the symlink 372 FILESTATUS3L fst; 373 APIRET arc = DosQueryPathInfo(buf, FIL_STANDARDL, &fst, sizeof(fst)); 374 if (arc == NO_ERROR) 375 { 376 // replace the information in the find buffer 377 ffb->fdateCreation = fst.fdateCreation; 378 ffb->ftimeCreation = fst.ftimeCreation; 379 ffb->fdateLastAccess = fst.fdateLastAccess; 380 ffb->ftimeLastAccess = fst.ftimeLastAccess; 381 ffb->fdateLastWrite = fst.fdateLastWrite; 382 ffb->ftimeLastWrite = fst.ftimeLastWrite; 383 ffb->cbFile = fst.cbFile; 384 ffb->cbFileAlloc = fst.cbFileAlloc; 385 ffb->attrFile = fst.attrFile; 386 } 387 else 388 { 389 // mark as broken symlink 390 d_ptr->fileFlags &= ~QAbstractFileEngine::ExistsFlag; 391 } 392 } 393 } 394 362 395 if (ffb->attrFile & FILE_DIRECTORY) 363 396 d_ptr->fileFlags |= QAbstractFileEngine::DirectoryType; -
trunk/src/corelib/io/qfsfileengine_os2.cpp
r1112 r1117 42 42 ****************************************************************************/ 43 43 44 // temporary, until struct dirent in kLIBC gets creation and access time fields45 #define QT_OS2_USE_DOSFINDFIRST46 47 44 #include "qplatformdefs.h" 48 45 #include "qabstractfileengine.h" … … 677 674 is_link = false; // drive/share names are never symlinks 678 675 } else { 679 #ifdef QT_OS2_USE_DOSFINDFIRST680 is_link = false;681 #else682 676 QT_STATBUF st; // don't clobber our main one 683 677 that->is_link = (QT_LSTAT(nativeFilePath.constData(), &st) == 0) ? 684 678 S_ISLNK(st.st_mode) : false; 685 #endif686 679 } 687 680 }
Note:
See TracChangeset
for help on using the changeset viewer.