Bug 103929 - indirect source fails on relative paths
Summary: indirect source fails on relative paths
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: datasources (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-15 04:45 UTC by George Staikos
Modified: 2010-08-14 14:40 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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