[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdelibs/frameworks] kdecore: Port away from KStandardDirs::realFilePath (and fix related comment)
From:       David Faure <faure () kde ! org>
Date:       2012-03-12 23:00:23
Message-ID: 20120312230023.68488A60BB () git ! kde ! org
[Download RAW message or body]

Git commit adc649eb2154b37f0fc8d276f3bc7817de1f3619 by David Faure.
Committed on 12/03/2012 at 23:59.
Pushed by dfaure into branch 'frameworks'.

Port away from KStandardDirs::realFilePath (and fix related comment)

M  +3    -1    kdecore/config/kconfig.cpp
M  +1    -1    kdecore/kernel/kstandarddirs.cpp

http://commits.kde.org/kdelibs/adc649eb2154b37f0fc8d276f3bc7817de1f3619

diff --git a/kdecore/config/kconfig.cpp b/kdecore/config/kconfig.cpp
index 0cacbd6..cf81a00 100644
--- a/kdecore/config/kconfig.cpp
+++ b/kdecore/config/kconfig.cpp
@@ -555,7 +555,9 @@ void KConfigPrivate::changeFileName(const QString& name, const char* type)
         } // else anonymous config.
         // KDE5: remove these magic overloads
     } else if (QDir::isAbsolutePath(fileName)) {
-        fileName = KStandardDirs::realFilePath(fileName);
+        fileName = QFileInfo(fileName).canonicalFilePath();
+        if (fileName.isEmpty()) // file doesn't exist (yet)
+            fileName = name;
         file = fileName;
     } else {
         if (type && *type)
diff --git a/kdecore/kernel/kstandarddirs.cpp b/kdecore/kernel/kstandarddirs.cpp
index fda3d58..ae4f3bb 100644
--- a/kdecore/kernel/kstandarddirs.cpp
+++ b/kdecore/kernel/kstandarddirs.cpp
@@ -1048,7 +1048,7 @@ KStandardDirs::realPath(const QString &dirname)
 #endif
 }
 
-// ####### KDE4: should this be removed, in favor of QDir::canonicalPath()?
+// ####### KDE4: should this be removed, in favor of QFileInfo::canonicalFilePath()?
 // aseigo: QDir::canonicalPath returns QString() if the dir doesn't exist
 //         and this method is often used with the expectation for it to work
 //         even if the directory doesn't exist. so ... no, we can't drop this
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic