Skip to content

Commit

Permalink
fix: existance check for imagej current directory
Browse files Browse the repository at this point in the history
see #37
  • Loading branch information
bogovicj committed Dec 2, 2021
1 parent a6c71e7 commit bce1110
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,18 @@ private String openBrowseDialog() {
fileChooser.setCurrentDirectory(new File(lastBrowsePath));
else if (initialContainerPath != null && !initialContainerPath.isEmpty())
fileChooser.setCurrentDirectory(new File(initialContainerPath));
else if (IJ.getInstance() != null)
fileChooser.setCurrentDirectory(new File(IJ.getDirectory("current")));
else if (IJ.getInstance() != null) {
File f = null;

final String currDir = IJ.getDirectory("current");
final String homeDir = IJ.getDirectory("home");
if( currDir != null )
f = new File( currDir );
else if( homeDir != null )
f = new File( homeDir );

fileChooser.setCurrentDirectory(f);
}

final int ret = fileChooser.showOpenDialog(dialog);
if (ret != JFileChooser.APPROVE_OPTION)
Expand Down

0 comments on commit bce1110

Please sign in to comment.