changeset 4383:3606cb5973b5

of-dicom: temporary fix
author John W. Eaton <jwe@octave.org>
date Thu, 27 Apr 2017 12:29:58 -0400
parents 60e22de65ba4
children d5a5b8e659de
files dist-files.mk src/of-dicom-1-fixes.patch
diffstat 2 files changed, 42 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dist-files.mk	Mon Apr 17 14:21:42 2017 -0400
+++ b/dist-files.mk	Thu Apr 27 12:29:58 2017 -0400
@@ -450,6 +450,7 @@
   of-database.mk \
   of-dataframe-1-fixes.patch \
   of-dataframe.mk \
+  of-dicom-1-fixes.patch \
   of-dicom.mk \
   of-financial.mk \
   of-fits-1-cross-fixes.patch \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/of-dicom-1-fixes.patch	Thu Apr 27 12:29:58 2017 -0400
@@ -0,0 +1,41 @@
+diff -uNr a/src/dicomdict.cpp b/src/dicomdict.cpp
+--- a/src/dicomdict.cpp	2011-12-20 15:52:53.000000000 -0500
++++ b/src/dicomdict.cpp	2017-04-27 09:05:53.295379421 -0400
+@@ -25,6 +25,8 @@
+  */
+ 
+ #include "octave/oct.h"
++#include "octave/octave.h"
++#include "octave/interpreter.h"
+ #include "octave/load-path.h"
+ 
+ #include "gdcm-2.0/gdcmDict.h"
+@@ -256,12 +258,23 @@
+ 	}
+ 
+ 	// find dic if it is anywhere in the search path (same path as for m-files etc)
++	std::string resolved_filename(filename);
++
+ #ifndef NOT_OCT
+-	const std::string resolved_filename=load_path::find_file(std::string(filename)) ;
+-#else
+-        // for debugging: if not running in octave, find_file always returns ""
+-	// so we just use the original filename
+-	const std::string resolved_filename(filename);
++        // Temporary fix.  Eventually, a pointer to the Octave
++        // interpreter should come from information passed to the
++        // DEFUN function that called us, not from global data.
++
++        octave::interpreter *interp = octave::application::the_interpreter ();
++
++        if (interp)
++          {
++            octave::load_path& lp = interp->get_load_path ();
++
++            resolved_filename = lp.find_file (std::string (filename));
++          }
++        else
++          warning ("load_dicom_dict: interpreter context missing");
+ #endif
+ 
+ 	std::ifstream fin(resolved_filename.c_str());