Ignore:
Timestamp:
Dec 14, 2009, 9:16:37 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

corelib/io: QSettings: Use IniFormat (plain INI files) when NativeFormat is requested instead of the Open32 registry which is known to be unstable and can be easily corrupted. The old behavior may be restored using the QT_PM_REGISTRY environment variable (#111).

File:
1 edited

Legend:

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

    r25 r425  
    11361136                         windowsConfigPath(CSIDL_COMMON_APPDATA) + QDir::separator());
    11371137#elif defined(Q_OS_OS2)
    1138         /* Though this code is very similar to the following #else statment,
    1139          * we have to do it separately for OS/2 and leave the original code
    1140          * intact since QDir::separator() returns ":" on Mac OS X while "/" is
    1141          * actually used in the #else below. */
     1138        /* Though this code is very similar to the following #else block, the
     1139         * definition of the "absolute path" is different on OS/2 (see
     1140         * isRelativePath() in qfsfileengine_os2.cpp) so take it into account)*/
    11421141        QString userPath;
    1143         QString env = QLatin1String(getenv("XDG_CONFIG_HOME"));
     1142        QString env = Qgetenv("XDG_CONFIG_HOME"));
    11441143        if (env.isEmpty()) {
    11451144            userPath = homePath;
    11461145            userPath += QDir::separator();
    11471146            userPath += QLatin1String(".config");
    1148         } else if (QDir::isAbsolutePath(env)) {
    1149             userPath = env;
    11501147        } else {
    1151             userPath = homePath;
    1152             userPath += QDir::separator();
    1153             userPath += env;
    1154         }
    1155         userPath += QDir::separator();
     1148            userPath = QDir::cleanPath(QDir(homePath).absoluteFilePath(env));
     1149        }
     1150        userPath = QDir::cleanPath(userPath) + QLatin1Char('/');
    11561151
    11571152        pathHash->insert(pathHashKey(QSettings::IniFormat, QSettings::UserScope), userPath);
     
    23862381    \o \c{%HOME%\.config\MySoft\Star Runner.ini}
    23872382    \o \c{%HOME%\.config\MySoft.ini}
    2388     \o \c{<boot_drv>:\OS2\xdg\MySoft\Star Runner.ini}
    2389     \o \c{<boot_drv>:\OS2\xdg\MySoft.ini}
     2383    \o \c{\xdg\MySoft\Star Runner.ini}
     2384    \o \c{\xdg\MySoft.ini}
    23902385    \endlist
    23912386
     
    34703465    \row    \o{1,2} Mac OS X    \o{1,2} IniFormat               \o UserScope   \o \c $HOME/.config
    34713466    \row                                                        \o SystemScope \o \c /etc/xdg
    3472     \row    \o{1,2} OS/2        \o{1,2} IniFormat               \o UserScope   \o \c $HOME\.config
    3473     \row                                                        \o SystemScope \o \c <boot_drv>:\OS2\xdg
     3467    \row    \o{1,2} OS/2        \o{1,2} IniFormat               \o UserScope   \o \c \.config
     3468    \row                                                        \o SystemScope \o \c \xdg
    34743469    \endtable
    34753470
     
    34773472    $HOME/Settings) can be overridden by the user by setting the
    34783473    \c XDG_CONFIG_HOME environment variable. The default SystemScope
    3479     paths on Unix, Mac OS X (\c /etc/xdg) and OS/2 (\c <boot_drv>:\OS2\xdg) can
    3480     be overridden when building the Qt library using the \c configure script's
     3474    paths on Unix, Mac OS X (\c /etc/xdg) and OS/2 (\c
     3475    overridden when building the Qt library using the \c configure script's
    34813476    \c
    34823477    --sysconfdir flag (see QLibraryInfo for details).
Note: See TracChangeset for help on using the changeset viewer.