Changeset 1134


Ignore:
Timestamp:
Mar 12, 2013, 10:48:53 PM (12 years ago)
Author:
Dmitry A. Kuminov
Message:

corelib: Make QDir::absoluteFilePath() kLIBC path rewrite aware. Extends r1112.

This fix makes it possible to use paths like /@unixroot for e.g. Qt system directories.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/corelib/io/qdir.cpp

    r1084 r1134  
    6262#include <stdlib.h>
    6363
     64#ifdef Q_OS_OS2
     65#ifdef __INNOTEK_LIBC__
     66#include <InnoTekLIBC/pathrewrite.h>
     67#endif
     68#endif
     69
    6470QT_BEGIN_NAMESPACE
    6571
     
    715721    bool curDirOnDriveRelative = false;
    716722    if (isAbsolutePath(fn)) {
     723#ifdef __INNOTEK_LIBC__
     724        // Make sure we perform any path rewrite before testing for real
     725        // absoluteness. This is necessary to avoid resolving paths like
     726        // /@unixroot/dir to X:/@unixroot/dir which would be wrong.
     727        char buf[PATH_MAX+1];
     728        if (__libc_PathRewrite(QFile::encodeName(fn).constData(), buf, sizeof(buf)) > 0)
     729            fn = QFile::decodeName(buf);
     730#endif
    717731        // filter out not really absolute cases
    718732        QChar ch0, ch1, ch2;
     
    737751            ret = QFileInfo(fn).absoluteFilePath();
    738752        } else {
     753            // we can't rely on the engine's AbsoluteName here, see the big comment above
    739754            if (curDriveRelative)
    740755                ret = ret.left(2); // only take the drive name from this QDir
Note: See TracChangeset for help on using the changeset viewer.