Changeset 1112


Ignore:
Timestamp:
Mar 1, 2013, 12:42:39 AM (12 years ago)
Author:
Dmitry A. Kuminov
Message:

corelib: Make sure OS/2 file engine takes kLIB path rewrite into account.

This is to make QDir::absoluteFilePath() and friends work for paths like
/@unixroot/dir (by translating them to X:/my_unixroot/dir instead of givng
invalid paths like X:/@unixroot/dir). See #282.

File:
1 edited

Legend:

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

    r796 r1112  
    6666#include <unistd.h>
    6767
     68
     69
     70
     71
    6872#include <pwd.h>
    6973#include <grp.h>
     
    798802        if (!::isRelativePath(d->filePath)) {
    799803            if (::isNotReallyAbsolutePath(d->filePath)) {
     804
    800805                char buf[PATH_MAX+1];
    801                 strcpy(buf, QFile::encodeName(d->filePath).constData());
     806#ifdef __INNOTEK_LIBC__
     807                // In kLIBC (0.6.5-), _abspath() doesn't perform path rewriting to expand
     808                // e.g. /@unixroot/dir to X:/my_unixroot/dir which confuses many apps by
     809                // translating such paths to invalid ones like X:/@unixroot/dir. Fix this
     810                // by calling path rewrite explicitly. @todo kLIBC should actually do that.
     811                if (__libc_PathRewrite(filePath.constData(), buf, sizeof(buf)) <= 0)
     812#endif
     813                    strcpy(buf, filePath.constData());
    802814                _abspath(buf, buf, sizeof(buf));
    803815                ret = QFile::decodeName(buf);
     
    856868                if (!::isRelativePath(target)) {
    857869                    if (::isNotReallyAbsolutePath(target)) {
     870
    858871                        char buf[PATH_MAX+1];
    859                         strcpy(buf, QFile::encodeName(target).constData());
     872#ifdef __INNOTEK_LIBC__
     873                        // In kLIBC (0.6.5-), _abspath() doesn't perform path rewriting to expand
     874                        // e.g. /@unixroot/dir to X:/my_unixroot/dir which confuses many apps by
     875                        // translating such paths to invalid ones like X:/@unixroot/dir. Fix this
     876                        // by calling path rewrite explicitly. @todo kLIBC should actually do that.
     877                        if (__libc_PathRewrite(filePath.constData(), buf, sizeof(buf)) <= 0)
     878#endif
     879                            strcpy(buf, filePath.constData());
    860880                        _abspath(buf, buf, sizeof(buf));
    861881                        ret = QFile::decodeName(buf);
Note: See TracChangeset for help on using the changeset viewer.