Re: Extra "/" addet in FileInfo.directory when using drag and drop?
Posted by
Juanjo Vega on
Jun 11, 2010; 9:09am
URL: http://imagej.273.s1.nabble.com/Extra-addet-in-FileInfo-directory-when-using-drag-and-drop-tp3687943p3687945.html
Hi,
I think I don't understand what you mean with catalog and subcatalog
tests and dragging. Your plugin uses the currently active image, so I
can't drag anything.
I ran your attached code and I got these results:
Directory: /home/juanjo/Desktop/SampleData/Imgs/
File name: img000012.xmp
I'm using imageJ on Ubuntu Linux, and for me it seems to be fine.
I don't know it this is enough to fix your problem, but I don't think
so.
Maybe if you try to explain it better I could help you.
Sincerelly,
Juanjo Vega.
On Thu, 2010-06-10 at 12:21 -0700, 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?
>
> Kind regards
> Gerald
>
> 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);
>
>
> }
>
> }
>