[Kst] extragear/graphics/kst/kst

Ted Kisner tskisner.public at gmail.com
Sat Nov 5 07:22:50 CET 2005


SVN commit 477795 by tskisner:

Currently, if you use kst from the commandline to view some raw data and then save the result to a new kst file, the filename tag gets set to the relative name, *NOT* the absolute path of the data file.  If you then go to another directory and try to open the kst file from there, kst crashes.  This patch prepends the current working directory to the relative name when loading the datasource, so that the behaviour is consistent with data files loaded from the GUI.

 M  +6 -1      main.cpp  


--- trunk/extragear/graphics/kst/kst/main.cpp #477794:477795
@@ -385,6 +385,9 @@
     bool nOK;
     int n_y = 0;
     KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+    QString cwd = args->cwd();
+    cwd.append("/");
+    QString path;
 
     CheckForCMDErrors(args);
 
@@ -494,7 +497,9 @@
 
       for (i_curve = i_v = 0, i_file = 0; i_file < args->count(); i_file++) {
         // make the file
-        file = KstDataSource::loadSource(args->arg(i_file));
+        path = cwd;
+        path.append(args->arg(i_file));
+        file = KstDataSource::loadSource(path);
         if (file) {
           if (!file->isValid() || file->isEmpty()) {
             kstdError() << i18n("No data in file %1.  Trying to continue...").arg(args->arg(i_file)) << endl;


More information about the Kst mailing list