Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1493829
 поиск   регистрация   авторизация 
 
Группа :: Графические оболочки/KDE
Пакет: kdelibs

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

Патч: kdelibs-3.0-exists_exe.patch


--- kdelibs-3.0/kdecore/kstandarddirs.cpp~	Thu Apr 11 18:30:43 2002
+++ kdelibs-3.0/kdecore/kstandarddirs.cpp	Thu Apr 11 18:31:24 2002
@@ -238,8 +238,18 @@
 
     for (QStringList::ConstIterator it = candidates.begin();
 	 it != candidates.end(); it++)
-      if (exists(*it + filename))
-	return *it;
+    {
+      if ( QString::compare("exe", type) == 0 )
+      {
+	  if (exists_exe(*it + filename))
+	      return *it;
+      }
+      else
+      {
+          if (exists(*it + filename))
+	      return *it;
+      }
+    }
 
 #ifndef NDEBUG
     if(false && type != "locale")
@@ -247,6 +257,19 @@
 #endif
 
     return QString::null;
+}
+
+bool KStandardDirs::exists_exe(const QString &fullPath)
+{
+    struct stat buff;
+    if (access(QFile::encodeName(fullPath), X_OK) == 0 && stat( QFile::encodeName(fullPath), &buff ) == 0)
+	if (fullPath.at(fullPath.length() - 1) != '/') {
+	    if (S_ISREG( buff.st_mode ))
+		return true;
+	} else
+	    if (S_ISDIR( buff.st_mode ))
+		return true;
+    return false;
 }
 
 bool KStandardDirs::exists(const QString &fullPath)
--- kdelibs-3.0/kdecore/kstandarddirs.h~	Thu Apr 11 18:33:15 2002
+++ kdelibs-3.0/kdecore/kstandarddirs.h	Thu Apr 11 18:32:53 2002
@@ -494,6 +494,7 @@
 	 * faster than creating a QFileInfo first
 	 */
 	static bool exists(const QString &fullPath);
+	static bool exists_exe(const QString &fullPath);
 
 
  private:
 
design & coding: Vladimir Lettiev aka crux © 2004-2005