Re: Bug report: File.directory () builtin function fails in -batch
Posted by
Rasband, Wayne (NIH/NIMH) [E] on
Mar 14, 2014; 6:18pm
URL: http://imagej.273.s1.nabble.com/Bug-report-File-directory-builtin-function-fails-in-batch-tp5006917p5006925.html
On Mar 14, 2014, at 10:45 AM, Carnë Draug wrote:
> The macro builtin function "File.directory()" does not work when
> starting ImageJ via command line -batch:
The latest ImageJ daily build (1.48t12) fixes a bug the caused the File.directory macro function to not work as expected after calling the open(path) macro function. Using the daily build, this test macro
path = "/Users/wayne/Pictures/Sandhills.jpg";
open(path);
print("path: "+path);
print ("dir: "+File.directory ());
print ("name: "+File.name ());
outputs
path: /Users/wayne/Pictures/Sandhills.jpg
dir: /Users/wayne/Pictures/
name: Sandhills.jpg
With earlier versions of ImageJ, it outputs
path: /Users/wayne/Pictures/Sandhills.jpg
dir:
name: Sandhills.jpg
-wayne
> 1) create a simple macro
>
> $ echo ''open (getArgument()); print (File.directory ());' > ./macro_test.ijm
>
> 2) see how File.directory() fails, displaying an empty message on the log window
>
> $ ImageJ-linux32 -batch ./macro_test.ijm ./path_to_image
>
> As a temporary workaround, I am using "getDirectory('image')" but they
> are different things. One returns the directory for the last opened
> using open(), while the other returns the currently active image.
>
> I am using ImageJ via FIJI in Debian Squeeze (current stable version)
> IJ.getVersion: 1.48s
> IJ.getFullVersion: 1.48s99
>
> Carnë
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html