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

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/kernel
From:       Christian Ehrlicher <Ch.Ehrlicher () gmx ! de>
Date:       2007-12-13 21:13:19
Message-ID: 1197580399.013131.11209.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 748204 by chehrlic:

special case for resource type "exe" on windows
--> findResource("exe", "meinproc4") should work now

CCMAIL: Ralf.Habacker@freenet.de

 M  +19 -5     kstandarddirs.cpp  


--- trunk/KDE/kdelibs/kdecore/kernel/kstandarddirs.cpp #748203:748204
@@ -408,10 +408,10 @@
 }
 
 QString KStandardDirs::findResource( const char *type,
-                                     const QString& filename ) const
+                                     const QString& _filename ) const
 {
-    if (!QDir::isRelativePath(filename))
-        return filename; // absolute dirs are absolute dirs, right? :-/
+    if (!QDir::isRelativePath(_filename))
+        return _filename; // absolute dirs are absolute dirs, right? :-/
 
 #if 0
     kDebug(180) << "Find resource: " << type;
@@ -423,6 +423,13 @@
     }
 #endif
 
+    QString filename(_filename);
+#ifdef Q_OS_WIN
+    if(strcmp(type, "exe") == 0) {
+      if(!filename.endsWith(QLatin1String(".exe")))
+        filename += QLatin1String(".exe");
+    }
+#endif
     const QString dir = findResourceDir(type, filename);
     if (dir.isEmpty())
         return dir;
@@ -499,15 +506,22 @@
 }
 
 QString KStandardDirs::findResourceDir( const char *type,
-                                        const QString& filename) const
+                                        const QString& _filename) const
 {
 #ifndef NDEBUG
-    if (filename.isEmpty()) {
+    if (_filename.isEmpty()) {
         kWarning() << "filename for type " << type << " in \
KStandardDirs::findResourceDir is not supposed to be empty!!";  return QString();
     }
 #endif
 
+    QString filename(_filename);
+#ifdef Q_OS_WIN
+    if(strcmp(type, "exe") == 0) {
+      if(!filename.endsWith(QLatin1String(".exe")))
+        filename += QLatin1String(".exe");
+    }
+#endif
     if (d->restrictionsActive && (strcmp(type, "data")==0))
         applyDataRestrictions(filename);
     QStringList candidates = resourceDirs(type);


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

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