[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kdecore/kernel
From: Benjamin Reed <ranger () befunk ! com>
Date: 2010-03-05 17:29:18
Message-ID: 1267810158.407194.32159.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1099488 by reed:
merge 1099482 from 4.4: work around OSX 10.6 fork .. exec restrictions
M +31 -4 kstandarddirs.cpp
--- trunk/KDE/kdelibs/kdecore/kernel/kstandarddirs.cpp #1099487:1099488
@@ -1215,10 +1215,19 @@
QString bundle = path;
bundle += ".app/Contents/MacOS/" + bundle.section('/', -1);
info.setFile( bundle );
- if ( info.exists() && ( ignore || info.isExecutable() )
- && ( info.isFile() || info.isSymLink() ) ) {
- kDebug(180) << "getBundle(): returning " << bundle;
- return bundle;
+ FILE *file;
+ if (file = fopen(info.absoluteFilePath().toUtf8().constData(), "r")) {
+ fclose(file);
+ struct stat _stat;
+ if ((stat(info.absoluteFilePath().toUtf8().constData(), &_stat)) < 0) {
+ return QString();
+ }
+ if ( ignore || (_stat.st_mode & S_IXUSR) ) {
+ if ( ((_stat.st_mode & S_IFMT) == S_IFREG) || ((_stat.st_mode & S_IFMT) == S_IFLNK) ) {
+ kDebug(180) << "getBundle(): returning " << bundle;
+ return bundle;
+ }
+ }
}
return QString();
}
@@ -1235,6 +1244,23 @@
#endif
QFileInfo info( path );
QFileInfo orig = info;
+#if defined(Q_OS_DARWIN) || defined(Q_OS_MAC)
+ FILE *file;
+ if (file = fopen(orig.absoluteFilePath().toUtf8().constData(), "r")) {
+ fclose(file);
+ struct stat _stat;
+ if ((stat(orig.absoluteFilePath().toUtf8().constData(), &_stat)) < 0) {
+ return QString();
+ }
+ if ( ignoreExecBit || (_stat.st_mode & S_IXUSR) ) {
+ if ( ((_stat.st_mode & S_IFMT) == S_IFREG) || ((_stat.st_mode & S_IFMT) == S_IFLNK) ) {
+ orig.makeAbsolute();
+ return orig.filePath();
+ }
+ }
+ }
+ return QString();
+#else
if( info.exists() && info.isSymLink() )
info = QFileInfo( info.canonicalFilePath() );
if( info.exists() && ( ignoreExecBit || info.isExecutable() ) && info.isFile() ) {
@@ -1246,6 +1272,7 @@
}
//kDebug(180) << "checkExecutable(): failed, returning empty string";
return QString();
+#endif
}
QString KStandardDirs::findExe( const QString& appname,
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic