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

List:       kde-core-devel
Subject:    [patch] make KDirWatch ignore empty paths
From:       Jarosław Staniek <js () iidea ! pl>
Date:       2008-04-30 21:03:21
Message-ID: 4818DE99.2010509 () iidea ! pl
[Download RAW message or body]

For review:
-ignore empty paths
-bonus: do not check if the path starts with /dev dir on windows

-- 
regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
  Kexi & KOffice (http://www.kexi.pl/en, http://www.koffice.org/kexi)
  KDE Libraries for MS Windows (http://windows.kde.org)

["kdirwatch.patch" (text/plain)]

Index: kdirwatch.cpp
===================================================================
--- kdirwatch.cpp	(wersja 802817)
+++ kdirwatch.cpp	(kopia robocza)
@@ -419,7 +419,7 @@
 KDirWatchPrivate::Entry* KDirWatchPrivate::entry(const QString& _path)
 {
 // we only support absolute paths
-  if (QDir::isRelativePath(_path)) {
+  if (_path.isEmpty() || QDir::isRelativePath(_path)) {
     return 0;
   }
 
@@ -596,7 +596,11 @@
                 Entry* sub_entry, bool isDir, KDirWatch::WatchModes watchModes)
 {
   QString path (_path);
-  if (path.startsWith("/dev/") || (path == "/dev"))
+  if (path.isEmpty()
+#ifndef Q_WS_WIN
+    || path.startsWith("/dev/") || (path == "/dev")
+#endif
+  )
     return; // Don't even go there.
 
   if ( path.length() > 1 && path.endsWith( QLatin1Char( '/' ) ) )


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

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