Login  Register

Re: Macro_Runner.java runMacroFromJar(String name) adds an extra "/" to the name, bug?

Posted by Markus Sutter on Jul 28, 2010; 2:56pm
URL: http://imagej.273.s1.nabble.com/Macro-Runner-java-runMacroFromJar-String-name-adds-an-extra-to-the-name-bug-tp3687452p3687453.html

Hi,
thx for your hint. I checked this demo already, but I thought there must be a simpler solution then loading the macro manually to a String and pass it do runMacro. Hence I looked into the IJ sources and found ij.plugin.Macro_Runner, which offers exactly that what I was looking for with the method runMacroFromJar(String name). But then I bumped into the problem with the extra "/".
Which I think is just a bug in the method runMacroFromJar(String name) in class   Macro_Runner
on line 48:
InputStream is = pcl.getResourceAsStream("/" + name); may should look like
InputStream is = pcl.getResourceAsStream(name)

(note: there is also the confusing ij.macro.MacroRunner)

I hope I could clarify a bit and I don't have to copy this getText method from the JAR Resources Demo.
Kind regards
Markus