Utility method for converting a search path string to an array of directory and JAR file
URLs.

Note that this method is called by the DocletInvoker.

@param path the search path string
@return the resulting array of directory and JAR file URLs
351557
private static URL[] pathToURLs(String path) {
        java.util.List<URL> urls = new ArrayList<>();
        for (String s: path.split(Pattern.quote(File.pathSeparator))) {
            if (!s.isEmpty()) {
                URL url = fileToURL(Paths.get(s));
                if (url != null) {
                    urls.add(url);
                }
            }
        }
        return urls.toArray(new URL[urls.size()]);
    }
1065710
public static String[] getParts(final String path) {

		String cleanedPath = clean(path);

		return StringUtils.splitByWholeSeparator(cleanedPath, PATH_SEP);
	}
1369623
public Certificate []getCertificates(String path)
  {
    if (! isSigned())
      return null;
    
    if (path.length() > 0 && path.charAt(0) == '/')
      path = path.substring(1);

    try {
      if (! getBacking().canRead())
        return null;
      
      JarFile jarFile = getJarFile();
      JarEntry entry;
      InputStream is = null;

      try {
        entry = jarFile.getJarEntry(path);

        if (entry != null) {
          is = jarFile.getInputStream(entry);

          while (is.skip(65536) > 0) {
          }

          is.close();

          return entry.getCertificates();
        }
      } finally {
        closeJarFile(jarFile);
      }
    } catch (IOException e) {
      log.log(Level.FINE, e.toString(), e);

      return null;
    }

    return null;
  }
384100
public static String pathToClassName(String path) {
        path = path.replace('/', '.');
        if (path.endsWith(CLASS_EXTENSION)) {
            path = path.substring(0, path.length() - CLASS_EXTENSION.length());
        }
        return path;
    }
874266
public static List<Win32FindData> listDir(String path) {
    final List<Win32FindData> results = new ArrayList<Win32FindData>();
    listDirectory(path, new INativeWin32APICallback() {
      @Override
      public void handleFile(String name, int attributes, long createTime, long lastAccessTime, long lastModifiedTime, long length) {
        if (!(name.equals(".") || name.equals(".."))) {
          results.add(new Win32FindData(attributes, createTime, lastAccessTime, lastModifiedTime, length, name));
        }
      }
    });
    return results;
  }
1005447
private List<String> splitPath(String path) {

        List<String> result = new ArrayList<String>();
        for (String token : path.split("/")) {
            if ("".equals(token)) {
                continue;
            }
            result.add(token);
        }
        return result;
    }
473346
public static List<String> readLinesWithClasspathOrFilePath(
            String classpathOrFilePath) {
        return getStringListAsOptWithClasspath(classpathOrFilePath)
                .filter(JMPredicate.getGreaterSize(0))
                .orElseGet(() -> JMFiles.readLines(classpathOrFilePath));
    }
915690
public List<String> lsFiles(String path) {
		return ls(path, new Filter<LsEntry>() {
			@Override
			public boolean accept(LsEntry t) {
				return false == t.getAttrs().isDir();
			}
		});
	}
135944
@Override
    public Enumeration<URL> getResources(final String path) throws IOException {
        final ResourceList resourceList = scanResult.getResourcesWithPath(path);
        if (resourceList == null || resourceList.isEmpty()) {
            return super.getResources(path);
        } else {
            return new Enumeration<URL>() {
                /** The idx. */
                int idx;

                @Override
                public boolean hasMoreElements() {
                    return idx < resourceList.size();
                }

                @Override
                public URL nextElement() {
                    return resourceList.get(idx++).getURL();
                }
            };
        }
    }
586639
public static ArrayList<File> getDirectoriesInDirectoryTree(String path) {
		File file = new File(path);
		return getContentsInDirectoryTree(file, "*", false, true);
	}
973058
public static URL ensureURL(String path ) {
		path = systemToUnix(path);
		URL url;
		try {
			url = new URL(path);
			if( url.getProtocol().equals("jar")) {
				return simplifyJarPath(url);
			}
		} catch (MalformedURLException e) {
			// might just be a file reference.
			try {
				url = new File(path).toURI().toURL(); // simplify the path. "1/2/../3" = "1/3"
			} catch (MalformedURLException e2) {
				return null;
			}
		}
		return url;
	}
228007
private Path[] listPaths(final Path path)
      throws IOException {
    Path[] children = null;
    ArrayList<Path> tmpChildrenPath = new ArrayList<>();
    if (fs.isDirectory(path)) {
      // Get children's path list.
      FileStatus[] chiledrenFileStatus = pathFilter == null ? fs.listStatus(path) : fs.listStatus(path, pathFilter);
      for (FileStatus childFileStatus : chiledrenFileStatus) {
        tmpChildrenPath.add(childFileStatus.getPath());
      }
      children = tmpChildrenPath.toArray(new Path[tmpChildrenPath.size()]);
    }
    if (children == null) {
      children = EMPTY_PATH_ARRAY;
    }
    if (comparator != null && children.length > 1) {
      Arrays.sort(children, comparator);
    }
    return children;
  }
150728
@Override
	public Set<String> getResourceNames(String path) {
		path = path.replace('/', File.separatorChar);
		File resource = new File(baseDir, path);
		return FileUtils.getResourceNames(resource);
	}
903989
public static String getClasspathFromPaths(File... paths) {
    Preconditions.checkNotNull(paths);

    final StringBuilder classpath = new StringBuilder();
    boolean isFirst = true;
    for (File path : paths) {
      if (!isFirst) {
        classpath.append(":");
      }
      final String subClasspath = getClasspathFromPath(path);
      if (subClasspath.length() > 0) {
        classpath.append(subClasspath);
        isFirst = false;
      }
    }

    return classpath.toString();
  }
931284
public List<String> lsDirs(String path) {
		return ls(path, new Filter<LsEntry>() {
			@Override
			public boolean accept(LsEntry t) {
				return t.getAttrs().isDir();
			}
		});
	}
664758
public static List getClasspathDirectories()
    {
        List directories = new ArrayList();
        List components = getClasspathComponents();
        for (Iterator i = components.iterator(); i.hasNext();)
        {
            String possibleDir = (String) i.next();
            File file = new File(possibleDir);
            if (file.isDirectory())
            {
                directories.add(possibleDir);
            }
        }
        List tomcatPaths = getTomcatPaths();
        if (tomcatPaths != null)
        {
            directories.addAll(tomcatPaths);
        }
        return directories;
    }
1150279
public static String getUrl(String path) {
        if (path == null) {
            return path;
        }

        ServletContext sc = ExecutionContext.getSession().getServletContext();

        if (path.startsWith("jar:")) {
            int i = path.indexOf("!");
            path = i < 0 ? path : path.substring(++i);
        }

        path = sc.getContextPath() + path;
        return path;
    }