diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/kconfiggroup.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/core/kconfiggroup.cpp b/src/core/kconfiggroup.cpp index 8b7cd863..f3ab2202 100644 --- a/src/core/kconfiggroup.cpp +++ b/src/core/kconfiggroup.cpp @@ -425,16 +425,13 @@ static QString translatePath(QString path) // krazy:exclude=passbyvalue return path; } - // we can not use KGlobal::dirs()->relativeLocation("home", path) here, - // since it would not recognize paths without a trailing '/'. - // All of the 3 following functions to return the user's home directory - // can return different paths. We have to test all them. - const QString homeDir0 = QFile::decodeName(qgetenv("HOME")); - const QString homeDir1 = QDir::homePath(); - const QString homeDir2 = QDir(homeDir1).canonicalPath(); - if (cleanHomeDirPath(path, homeDir0) || cleanHomeDirPath(path, homeDir1) || cleanHomeDirPath(path, homeDir2)) { - // qDebug() << "Path was replaced\n"; - } + // Use the same thing as what expandString() will do, to keep data intact +#ifdef Q_OS_WIN + const QString homeDir = QDir::homePath(); +#else + const QString homeDir = QFile::decodeName(qgetenv("HOME")); +#endif + (void)cleanHomeDirPath(path, homeDir); if (startsWithFile) { path = QUrl::fromLocalFile(path).toString(); |