private <P extends JpsElement> void addSourceFolder(@NotNull String path,
                                                      final @NotNull JpsModuleSourceRootType<P> rootType,
                                                      boolean ifNotEmpty,
                                                      final @NotNull P properties) {
    if (ifNotEmpty) {
      String[] childs = new File(toPath(path).getPath()).list();
      if (childs == null || childs.length == 0) return;
    }
    else {
      if (!exists(path)) return;
    }

    Url url = toUrl(path);
    myRootModelModuleExtension.addSourceFolder(url, rootType, properties);
  }
private <P extends JpsElement> void addSourceFolder(@NotNull String path,
                                                      final @NotNull JpsModuleSourceRootType<P> rootType,
                                                      boolean ifNotEmpty,
                                                      final @NotNull P properties)