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

List:       kde-commits
Subject:    [baloo] src/engine: There is no QT_LSTAT on Windows, use QT_STAT and follow shortcut (if needed), on
From:       Andrius da Costa Ribas <andriusmao () gmail ! com>
Date:       2016-04-24 12:44:20
Message-ID: E1auJOe-0000j8-1u () scm ! kde ! org
[Download RAW message or body]

Git commit 0475e40d65036cb46f84740f4195d239030f13f1 by Andrius da Costa Ribas.
Committed on 24/04/2016 at 12:41.
Pushed by andriusr into branch 'master'.

There is no QT_LSTAT on Windows, use QT_STAT and follow shortcut (if needed), only on Windows, instead.
REVIEW: 127727

M  +15   -0    src/engine/idutils.h

http://commits.kde.org/baloo/0475e40d65036cb46f84740f4195d239030f13f1

diff --git a/src/engine/idutils.h b/src/engine/idutils.h
index 7c4f898..cc7da9c 100644
--- a/src/engine/idutils.h
+++ b/src/engine/idutils.h
@@ -26,6 +26,10 @@
 #include <qplatformdefs.h>
 #include <qglobal.h>
 
+#ifdef Q_OS_WIN
+# include <QFileInfo>
+#endif
+
 namespace Baloo {
 
 inline quint64 devIdAndInodeToId(quint32 devId, quint32 inode)
@@ -52,9 +56,20 @@ inline quint64 statBufToId(const QT_STATBUF& stBuf)
 inline quint64 filePathToId(const QByteArray& filePath)
 {
     QT_STATBUF statBuf;
+#ifndef Q_OS_WIN
     if (QT_LSTAT(filePath.constData(), &statBuf) != 0) {
         return 0;
     }
+#else
+    if (QT_STAT(filePath.constData(), &statBuf) != 0) {
+        return 0;
+    }
+    if (QFileInfo(filePath).isSymLink()) {
+        if (QT_STAT(QFileInfo(filePath).symLinkTarget().toUtf8().constData(), &statBuf) != 0) {
+            return 0;
+        }
+    }
+#endif
     return statBufToId(statBuf);
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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