| Summary: | indirect source fails on relative paths | ||
|---|---|---|---|
| Product: | [Applications] kst | Reporter: | George Staikos <staikos> |
| Component: | datasources | Assignee: | kst |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 1.x | ||
| Target Milestone: | --- | ||
| Platform: | Compiled Sources | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
George Staikos
2005-04-15 04:45:23 UTC
Should wait for 1.1.1 / 1.2.0 because it may impact existing setups. We need to ask around first, and test. BLAST always uses absolute paths. 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);
}
Change version to 1.x |