public static void setFilechooserBasepath(Path path) {
        if (Files.isDirectory(path, LinkOption.NOFOLLOW_LINKS)) {
            Settings.filechooserBasepath = path;
        } else {
            Settings.filechooserBasepath = path.getParent();
        }
    }