Bug 103929

Summary: indirect source fails on relative paths
Product: [Applications] kst Reporter: George Staikos <staikos>
Component: datasourcesAssignee: kst
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description George Staikos 2005-04-15 04:45:23 UTC
The indirect source fails on relative paths.  It should try a path relative to 
the absolute path of the .cur file if the path is not absolute.
Comment 1 George Staikos 2005-04-15 04:59:47 UTC
Should wait for 1.1.1 / 1.2.0 because it may impact existing setups.  We need to ask around first, and test.
Comment 2 Netterfield 2005-04-15 16:19:38 UTC
BLAST always uses absolute paths.
Comment 3 George Staikos 2005-07-08 00:03:03 UTC
SVN commit 432584 by staikos:

Add support for relative paths in indirect sources
BUG: 103929


 M  +18 -0     indirect.cpp  


--- trunk/extragear/graphics/kst/kst/datasources/indirect/indirect.cpp #432583:432584
@@ -17,7 +17,9 @@
 
 #include "indirect.h"
 
+#include <qdir.h>
 #include <qfile.h>
+#include <qfileinfo.h>
  
 
 IndirectSource::IndirectSource(KConfig *cfg, const QString& filename, KstDataSourcePtr child)
@@ -45,6 +47,10 @@
   if (f.open(IO_ReadOnly)) {
     QString ifn;
     if (0 < f.readLine(ifn, 1000)) {
+      if (QFileInfo(ifn).isRelative()) {
+        ifn = QFileInfo(_filename).dirPath(true) + QDir::separator() + ifn;
+      }
+
       if (!_child || ifn.stripWhiteSpace() != _child->fileName()) {
         _child = 0L; // release
         KstDataSourcePtr p = KstDataSource::loadSource(ifn.stripWhiteSpace());
@@ -124,6 +130,10 @@
     return 0L;
   }
 
+  if (QFileInfo(ifn).isRelative()) {
+    ifn = QFileInfo(filename).dirPath(true) + QDir::separator() + ifn;
+  }
+
   KstDataSourcePtr p = KstDataSource::loadSource(ifn.stripWhiteSpace());
   f.close();
 
@@ -155,6 +165,10 @@
     return 0;
   }
 
+  if (QFileInfo(ifn).isRelative()) {
+    ifn = QFileInfo(filename).dirPath(true) + QDir::separator() + ifn;
+  }
+
   return QFile::exists(ifn.stripWhiteSpace()) ? percent : 0;
 }
 
@@ -174,6 +188,10 @@
     return QStringList();
   }
 
+  if (QFileInfo(ifn).isRelative()) {
+    ifn = QFileInfo(filename).dirPath(true) + QDir::separator() + ifn;
+  }
+
   return KstDataSource::fieldListForSource(ifn.stripWhiteSpace(), type, typeSuggestion, complete);
 }
 
Comment 4 Peter Kümmel 2010-08-14 14:40:38 UTC
Change version to 1.x