private @Nullable Loader createLoader(@NotNull Path file) throws IOException {
    BasicFileAttributes fileAttributes;
    try {
      fileAttributes = Files.readAttributes(file, BasicFileAttributes.class);
    }
    catch (NoSuchFileException ignore) {
      return null;
    }
    catch (RuntimeException e) {
      throw new RuntimeException("Failed to read attributes of file from " + file.getFileSystem(), e);
    }

    if (fileAttributes.isDirectory()) {
      return useCache && !isNewClassLoadingEnabled
             ? FileLoader.createCachingFileLoader(file, cachePool, cachingCondition, isClassPathIndexEnabled, cache)
             : new FileLoader(file);
    }
    else if (!fileAttributes.isRegularFile()) {
      return null;
    }

    ResourceFile zipFile = resourceFileFactory.apply(file);
    JarLoader loader = new JarLoader(file, this, zipFile);
    if (useCache) {
      ClasspathCache.IndexRegistrar data = cachePool == null ? null : cachePool.loaderIndexCache.get(file);
      if (data == null) {
        data = zipFile.buildClassPathCacheData();
        if (cachePool != null && cachingCondition != null && cachingCondition.test(file)) {
          cachePool.loaderIndexCache.put(file, data);
        }
      }
      cache.applyLoaderData(data, loader);
    }

    String filePath = file.toString();
    if (filePath.startsWith(CLASSPATH_JAR_FILE_NAME_PREFIX, filePath.lastIndexOf(File.separatorChar) + 1)) {
      addFromManifestClassPathIfNeeded(file, zipFile, loader);
    }
    return loader;
  }
private @Nullable Loader createLoader(@NotNull Path file)