Changeset 813 for trunk/src/corelib


Ignore:
Timestamp:
Nov 4, 2010, 12:31:36 AM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

corelib: QLibraryInfo uses the QT_CONFIGURE_QT_SYSCONF_FILE value on OS/2 to probe for the system-wide qt.conf file containing library paths. The old "%ETC%\qtsys.conf" file is still supported.

File:
1 edited

Legend:

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

    r651 r813  
    8181    }
    8282    return path;
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
    8398}
    8499
     
    161176        if (!QFile::exists(qtconfig)) {
    162177            // search in the system-wide location
    163             qtconfig = QString::fromLocal8Bit(qgetenv("ETC"));
    164             if (qtconfig.isEmpty())
    165                 qtconfig = QDir::rootPath();
    166             qtconfig = QDir::fromNativeSeparators(qtconfig) +
    167                        QLatin1String("/qtsys.conf");
    168             qtconfig = QDir::cleanPath(qtconfig);
     178#ifdef QT_CONFIGURE_QT_SYSCONF_FILE
     179            qtconfig = expandEnvVars(QString::fromLocal8Bit(QT_CONFIGURE_QT_SYSCONF_FILE));
     180            if (!QFile::exists(qtconfig))
     181#endif
     182            {
     183                // search in %ETC% for backward compatibility
     184                QString etc = QString::fromLocal8Bit(qgetenv("ETC"));
     185                if (etc.isEmpty())
     186                    etc = QDir::rootPath();
     187                etc = QDir::fromNativeSeparators(etc);
     188                qtconfig = QDir::cleanPath(etc + QLatin1String("/qt.conf"));
     189                if (!QFile::exists(qtconfig)) {
     190                    qtconfig = QDir::cleanPath(etc + QLatin1String("/qtsys.conf"));
     191                }
     192            }
    169193        }
    170194    }
     
    341365            ret = QString::fromLocal8Bit(path);
    342366#ifdef Q_OS_OS2
    343             // expand environment variables in the form $(ENVVAR)
    344             int rep;
    345             QRegExp reg_var(QLatin1String("\\$\\(.*\\)"));
    346             reg_var.setMinimal(true);
    347             while((rep = reg_var.indexIn(ret)) != -1) {
    348                 ret.replace(rep, reg_var.matchedLength(),
    349                             QFile::decodeName(qgetenv(ret.mid(rep + 2,
    350                                 reg_var.matchedLength() - 3).toLatin1().constData()).constData()));
    351             }
     367            ret = expandEnvVars(ret);
    352368#endif
    353369        }
     
    468484            }
    469485            ret = config->value(subKey + key, defaultValue).toString();
    470             // expand environment variables in the form $(ENVVAR)
    471             int rep;
    472             QRegExp reg_var(QLatin1String("\\$\\(.*\\)"));
    473             reg_var.setMinimal(true);
    474             while((rep = reg_var.indexIn(ret)) != -1) {
    475                 ret.replace(rep, reg_var.matchedLength(),
    476                             QFile::decodeName(qgetenv(ret.mid(rep + 2,
    477                                 reg_var.matchedLength() - 3).toLatin1().constData()).constData()));
    478             }
     486#ifdef Q_OS_OS2
     487            ret = expandEnvVars(ret);
     488#endif
    479489            config->endGroup();
    480490        }
Note: See TracChangeset for help on using the changeset viewer.