Login  Register

Re: Extra "/" addet in FileInfo.directory when using drag and drop?

Posted by Rasband, Wayne (NIH/NIMH) [E] on Jun 11, 2010; 5:11pm
URL: http://imagej.273.s1.nabble.com/Extra-addet-in-FileInfo-directory-when-using-drag-and-drop-tp3687943p3687944.html

On Jun 10, 2010, at 3:21 PM, GeraldT wrote:

> Hello everybody,
>
> I have tried to google the problem, but did not fine an answer. I am using
> the FileInfo class i ImageJ
> to get the directory and the file name of the graphic file my plugin is
> working on. If I drag files (single files,
> or a group of selected files in a directonary everything works ok (output
> from sample plugin):
> Directory: C:\Program Files\ImageJ\plugins\Geralds\test\
> test.tif
>
> If I instead choose to drag an entire catalog (subcatalog test) with all the
> pictures inside the same sample plugin shows this output:
> Directory: C:\Program Files\ImageJ\plugins\Geralds\test/\
> test.tif
>
> It is not dificoult to remove this '/' but I am afraid this may couse
> problems on other OS than Windows (I use XP).
>
> Any idea why FileInfo behaves like that?

This bug is fixed in the 1.44c11 daily build.

-wayne


> Sample plugin:
>
> import java.awt.*;
> import java.io.*;
> import ij.plugin.frame.*;
> import ij.*;
> import ij.process.*;
> import ij.gui.*;
> import ij.ImagePlus;
> import ij.io .*;
>
> public class FileInfoTest extends PlugInFrame {
>
> ImagePlus imp;
> ImageProcessor imPro;
> Frame instance;
>
> String resultFileName = "Testfile.txt";
>
> public FileInfoTest() {
> super("FileInfoTest");
> if (instance!=null) {
> instance.toFront();
> return;
> }
>
> instance = this;
> imp = WindowManager.getCurrentImage();
> if (imp==null) {
> IJ.beep();
> IJ.noImage();
> return;
> }
>
> imPro = imp.getProcessor();
>
> FileInfo fi = imp.getOriginalFileInfo();
> IJ.log("Directory: " + fi.directory);
> IJ.log("File name: " + fi.fileName);
>
>
> }
>
> }
>
> --
> View this message in context: http://imagej.588099.n2.nabble.com/Extra-addet-in-FileInfo-directory-when-using-drag-and-drop-tp5164874p5164874.html
> Sent from the ImageJ mailing list archive at Nabble.com.