Changeset 366 for trunk/src


Ignore:
Timestamp:
Nov 30, 2009, 11:56:07 PM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

corelib/global: Correct QLibraryPath after rolling back r355 and friends so that it still correctly resolves paths like '\some\dir'.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/corelib/global/qlibraryinfo.cpp

    r357 r366  
    481481    }
    482482
     483#ifdef Q_OS_OS2
     484
     485    // QDir::isRelativePath() isn't precise on OS/2 (see
     486    // QDir::absoluteFilePath()) therefore we don't rely on it
     487    if (loc == PrefixPath) {
     488#ifdef QT_BUILD_QMAKE
     489        QFileInfo fi(qmake_libraryInfoFile());
     490        return QDir::cleanPath(QDir(fi.absolutePath()).absoluteFilePath(ret));
     491#else
     492        QSettings *config = QLibraryInfoPrivate::configuration();
     493        if (config) {
     494            // if we read paths from qt[sys].conf, the Prefix is relative to
     495            // the directory we load qt[sys].conf from
     496            QFileInfo fi(config->fileName());
     497            return QDir::cleanPath(QDir(fi.absolutePath()).absoluteFilePath(ret));
     498        } else {
     499            // we make the prefix path absolute to the executable's directory
     500            if (QCoreApplication::instance()) {
     501                return QDir::cleanPath(QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(ret));
     502            }
     503            return QDir::current().absoluteFilePath(ret);
     504        }
     505#endif
     506    }
     507
     508    // we make any other path absolute to the prefix directory
     509    return QDir::cleanPath(QDir(location(PrefixPath)).absoluteFilePath(ret));
     510
     511#else // #ifdef Q_OS_OS2
     512
    483513    if (QDir::isRelativePath(ret)) {
    484514        if (loc == PrefixPath) {
     
    488518            return QDir::cleanPath(QDir(fi.absolutePath()).absoluteFilePath(ret));
    489519#else
    490 #ifdef Q_OS_OS2
    491             QSettings *config = QLibraryInfoPrivate::configuration();
    492             if (config) {
    493                 // if we read paths from qt[sys].conf, the Prefix is relative to
    494                 // the directory we load qt[sys].conf from
    495                 QFileInfo fi(config->fileName());
    496                 return QDir::cleanPath(QDir(fi.absolutePath()).absoluteFilePath(ret));
    497             }
    498             else
    499 #endif
    500520            if (QCoreApplication::instance()) {
    501521#ifdef Q_OS_MAC
     
    520540    }
    521541    return QDir::cleanPath(ret);
     542
     543#endif // #ifdef Q_OS_OS2
    522544}
    523545
Note: See TracChangeset for help on using the changeset viewer.