Группа :: Система/Библиотеки
Пакет: kde4libs
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: kdelibs-4.1.96-alt-exists_ext.patch
Скачать
Скачать
--- kdelibs-4.1.96/kdecore/kernel/kstandarddirs.cpp~ 2009-01-13 18:29:30 +0300
+++ kdelibs-4.1.96/kdecore/kernel/kstandarddirs.cpp 2009-01-13 18:31:17 +0300
@@ -555,7 +555,7 @@ QString KStandardDirs::findResourceDir(
for (QStringList::ConstIterator it = candidates.begin();
it != candidates.end(); ++it) {
- if (exists(*it + filename)) {
+ if (exists_ext(*it + filename, (strcmp("exe",type)==0)? X_OK: R_OK)) {
return *it;
}
}
@@ -568,7 +568,7 @@ QString KStandardDirs::findResourceDir(
return QString();
}
-bool KStandardDirs::exists(const QString &fullPath)
+bool KStandardDirs::exists_ext(const QString &fullPath, int mode)
{
#ifdef Q_OS_WIN
// access() and stat() give a stupid error message to the user
@@ -580,7 +580,7 @@ bool KStandardDirs::exists(const QString
#else
KDE_struct_stat buff;
QByteArray cFullPath = QFile::encodeName(fullPath);
- if (access(cFullPath, R_OK) == 0 && KDE_stat( cFullPath, &buff ) == 0) {
+ if (access(cFullPath, mode) == 0 && KDE_stat( cFullPath, &buff ) == 0) {
if (!fullPath.endsWith('/')) {
if (S_ISREG( buff.st_mode ))
return true;
@@ -592,6 +592,11 @@ bool KStandardDirs::exists(const QString
#endif
}
+bool KStandardDirs::exists(const QString &fullPath)
+{
+ return exists_ext(fullPath, R_OK);
+}
+
static void lookupDirectory(const QString& path, const QString &relPart,
const QRegExp ®exp,
QStringList& list,
--- kdelibs-4.0.0/kdecore/kernel/kstandarddirs.h~ 2008-01-28 20:28:15 +0300
+++ kdelibs-4.0.0/kdecore/kernel/kstandarddirs.h 2008-01-28 20:42:07 +0300
@@ -672,6 +672,7 @@ public:
* @return @c true if the directory exists, @c false otherwise
*/
static bool exists(const QString &fullPath);
+ static bool exists_ext(const QString &fullPath, int mode);
/**
* Expands all symbolic links and resolves references to