Posted by
Burger Wilhelm on
Apr 06, 2015; 6:20am
URL: http://imagej.273.s1.nabble.com/Possible-to-set-default-directory-tp5012356p5012361.html
Hello Jon,
I recently also had problems with OpenDialog that might be related to yours. Calls to OpenDialog.setDefaultDirectory() had no effect, i.e., they left the default directory unchanged. I had no time to investigate further but noticed that, e.g., after calling
OpenDialog.setDefaultDirectory("/");
the result from OpenDialog.getDefaultDirectory() was the path "/\". Looking at the source code this is due to the instruction (
http://rsbweb.nih.gov/ij/developer/source/ij/io/OpenDialog.java.html)
defaultDirectory = defaultDirectory + File.separator;
at the end of the setDefaultDirectory method (and "\" being the default file separator in Windows). I am not sure the problem shows in non-Windows environments at all.
In any event, the problem mysteriously disappeared when I set the "Use JFileChooser to open/save" in the Input/Output... options. This might explain why the problem appears inconsistently and I still suspect there is a bug in the setDefaultDirectory method.
Hope this helps,
Wilhelm
________________________________________
From: ImageJ Interest Group [
[hidden email]] On Behalf Of Jon Harman [
[hidden email]]
Sent: Sunday, April 05, 2015 20:10
To:
[hidden email]
Subject: Possible to set default directory
Hi,
When my plugin is executed from a command line sometimes the default
directory gets incorrectly set (to c:\windows).
So far I have not not figured out what is going on, but a possible fix
would be to set that default directory to be the directory of the image
opened in my plugin. Any way to do that? I don't see any way in the
ImageJ open code.
Jon
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html