public static void loadProject(JpsProject project,
                                 Map<String, String> pathVariables,
                                 @NotNull JpsPathMapper pathMapper,
                                 @NotNull Path projectPath,
                                 @Nullable Path externalConfigurationDirectory,
                                 @NotNull Executor executor,
                                 boolean loadUnloadedModules) throws IOException {
    if (Files.isRegularFile(projectPath) && projectPath.toString().endsWith(".ipr")) {
      new JpsProjectLoader(project, pathVariables, pathMapper, projectPath.getParent(), null, loadUnloadedModules)
        .loadFromIpr(projectPath, executor);
    }
    else {
      Path dotIdea = projectPath.resolve(PathMacroUtil.DIRECTORY_STORE_NAME);
      Path directory;
      if (Files.isDirectory(dotIdea)) {
        directory = dotIdea;
      }
      else if (Files.isDirectory(projectPath) && projectPath.endsWith(PathMacroUtil.DIRECTORY_STORE_NAME)) {
        directory = projectPath;
      }
      else {
        throw new IOException("Cannot find IntelliJ IDEA project files at " + projectPath);
      }
      new JpsProjectLoader(project, pathVariables, pathMapper, directory.getParent(), externalConfigurationDirectory, loadUnloadedModules)
        .loadFromDirectory(directory, executor);
    }
  }
public static void loadProject(JpsProject project,
                                 Map<String, String> pathVariables,
                                 @NotNull JpsPathMapper pathMapper,
                                 @NotNull Path projectPath,
                                 @Nullable Path externalConfigurationDirectory,
                                 @NotNull Executor executor,
                                 boolean loadUnloadedModules)