Группа :: Система/Библиотеки
Пакет: kde4libs
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: kdelibs-4.1.0-alt-exists_ext.patch
Скачать
Скачать
--- kdelibs-4.1.0/kdecore/kernel/kstandarddirs.cpp~ 2008-07-30 18:50:25 +0400
+++ kdelibs-4.1.0/kdecore/kernel/kstandarddirs.cpp 2008-07-30 18:51:36 +0400
@@ -537,7 +537,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;
}
}
@@ -550,7 +550,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
@@ -561,7 +561,7 @@ bool KStandardDirs::exists(const QString
return QFileInfo(fullPath).exists();
#else
KDE_struct_stat buff;
- if (access(QFile::encodeName(fullPath), R_OK) == 0 && KDE_stat( QFile::encodeName(fullPath), &buff ) == 0) {
+ if (access(QFile::encodeName(fullPath), mode) == 0 && KDE_stat( QFile::encodeName(fullPath), &buff ) == 0) {
if (!fullPath.endsWith('/')) {
if (S_ISREG( buff.st_mode ))
return true;
@@ -573,6 +573,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