code: public Optional<Path> getArduinoDirectory() {
          if (arduinoDirectory != null) {
              return Optional.ofNullable(Paths.get(arduinoDirectory));
          }
  
          logger.log(Level.INFO, "Looking for Árduino directory");
  
          Path arduinoPath = Paths.get(homeDirectory, "Documents/Arduino");
          if (!Files.exists(arduinoPath)) {
              logger.log(Level.INFO, "Not found in " + arduinoPath);
  
              // try again in the onedrive folder, noticed it there on several windows machines
              arduinoPath = Paths.get(homeDirectory, "OneDrive/Documents/Arduino");
          }
          if (!Files.exists(arduinoPath)) {
              logger.log(Level.INFO, "Not found in " + arduinoPath);
  
              Optional<String> path = getArduinoPathWithDialog();
              if (path.isPresent()) {
                  logger.log(Level.INFO, "Finally found in  " + path);
                  arduinoPath = Paths.get(path.get());
              }
          }
  
          if (!Files.exists(arduinoPath)) return Optional.empty();
  
          logger.log(Level.INFO, "looking for libraries");
  
          // there was an arduino install without a libraries directory - add it.
          Path libsPath = arduinoPath.resolve("libraries");
          if (!Files.exists(libsPath)) {
              try {
                  logger.log(Level.INFO, "Creating libraries folder");
                  Files.createDirectory(libsPath);
              } catch (IOException e) {
                  return Optional.empty();
              }
          }
  
          arduinoDirectory = arduinoPath.toString();
  
          return Optional.of(arduinoPath);
      }
docs: Finds and then caches the arduino directory on the file system, looking in the usual places. Should
  it fail, it will pop up a dialog asking for the directory.
  
  @return the arduino directory.