code: private Optional<String> getArduinoPathWithDialog() {
          String savedPath = Preferences.userNodeForPackage(ArduinoLibraryInstaller.class)
                  .get(ARDUINO_CUSTOM_PATH, homeDirectory);
  
          Path libsPath = Paths.get(savedPath, "libraries");
          if (Files.exists(libsPath)) return Optional.of(savedPath);
  
          TextInputDialog dialog = new TextInputDialog(savedPath);
          dialog.setTitle("Manually enter Arduino Path");
          dialog.setHeaderText("Please manually enter the full path to the Arduino folder");
          dialog.setContentText("Arduino Path");
          Optional<String> path = dialog.showAndWait();
          path.ifPresent((p) -> Preferences.userNodeForPackage(ArduinoLibraryInstaller.class).put(ARDUINO_CUSTOM_PATH, p));
          return path;
      }
docs: This method will be called internally by the above method when a non standard layout is detected.
  
  @return the arduino path wrapped in an optional, or nothing if cancel is pressed.