SimpleChooserControl contains the following:
|
if (!new File(previousPath).isDirectory()) { |
|
Path path = Paths.get(previousPath); |
|
previousPath = path.getParent().toAbsolutePath().toString(); |
|
} |
|
currentInitialDirectory = new File(previousPath); |
There's two problems here:
- If the parent also doesn't exist (ie: C:\a\b) a NPE is thrown and nothing is displayed
- If that path is not valid, and does not contain a parent (ie: a), a NPE is thrown and nothing is displayed
I think this could be fixed by changing:
if (!new File(previousPath).isDirectory()) {
Path path = Paths.get(previousPath);
previousPath = path.getParent().toAbsolutePath().toString();
to
while (!new File(previousPath).isDirectory()) {
Path path = Paths.get(previousPath);
Path potentialParent = path.getParent();
previousPath = potentialParent != null ? potentialParent.toAbsolutePath().toString() : null;
SimpleChooserControl contains the following:
PreferencesFX/preferencesfx/src/main/java/com/dlsc/preferencesfx/formsfx/view/controls/SimpleChooserControl.java
Lines 131 to 135 in 4c65404
There's two problems here:
I think this could be fixed by changing:
to