private Path workingDirectorySupplier() {

        if (!Platform.isFxApplicationThread()) {
            final CompletableFuture<Path> completableFuture = new CompletableFuture<>();
            completableFuture.runAsync(() -> {
                threadService.runActionLater(() -> {
                    try {
                        Path path = workingDirectorySupplier();
                        completableFuture.complete(path);
                    } catch (Exception e) {
                        completableFuture.completeExceptionally(e);
                    }
                });
            }, threadService.executor());
            return completableFuture.join();
        }

        final DirectoryChooser directoryChooser = newDirectoryChooser("Select working directory");
        final File file = directoryChooser.showDialog(null);

        workingDirectory = Optional.ofNullable(file.toPath());
        eventService.sendEvent(DirectoryService.WORKING_DIRECTORY_UPDATE_EVENT, workingDirectory.orElse(null));

        return workingDirectory.orElse(null);
    }
Resolve a file to a valid base browsing directory
@param referenceFile The base directory or a child file that should be used as a browsing base path
@return A valid directory's File object
src/main/java/com/kodedu/service/impl/DirectoryServiceImpl.java