Finds an icon from a root directory (for an application and/or template).
@param rootDirectory a root directory
@return an existing file, or null if no icon was found
351644
public static File findIcon( File rootDirectory ) {

		File result = null;
		File[] imageFiles = new File( rootDirectory, Constants.PROJECT_DIR_DESC ).listFiles( new ImgeFileFilter());
		if( imageFiles != null ) {

			// A single image? Take it...
			if( imageFiles.length == 1 ) {
				result = imageFiles[ 0 ];
			}

			// Otherwise, find the "application." file
			else for( File f : imageFiles ) {
				if( f.getName().toLowerCase().startsWith( "application." ))
					result = f;
			}
		}

		return result;
	}
18699
public static String findSingleMainClass(File rootFolder) throws IOException {
        MainClassesCallback callback = new MainClassesCallback();
        MainClassFinder.doWithMainClasses(rootFolder, callback);
        return callback.getMainClass();
    }
1359287
def iconFile( self ):
        
        if not os.path.isfile(self._iconFile):
            return projexui.resources.find(self._iconFile)
        return self._iconFile
500674
public static ImageIcon loadImageIcon(final String iconName, final Class<?> clazz) {
        ImageIcon icon = null;

        if (iconName != null) {
            final URL iconResource = clazz.getResource(iconName);
            if (iconResource == null) {
                LOGGER.error("Icon could not be loaded: '" + iconName);
                icon = null;
            } else {
                icon = new ImageIcon(iconResource);
            }
        }

        return icon;
    }
302506
def fix_icon(dir)
      if File.exists?(dir+"/icon.png")
        # All ok
      elsif File.exists?(dir+"/icon-lg.png")
        FileUtils.mv(dir+"/icon-lg.png", dir+"/icon.png")
      else
        FileUtils.cp(@opts.template+"/resources/images/default-guide.png", dir+"/icon.png")
      end
    end
1016867
protected File getResourcesDirectory()
    {

        if ( resourcesDirectory == null )
        {
            resourcesDirectory = new File( getProject().getBasedir(), DEFAULT_RESOURCES_DIR );
        }

        return resourcesDirectory;

    }
284666
private static Collection<? extends URL> doFindPathMatchingFileResources(final URL rootDirResource, final String subPattern) {

        File rootFile = null;
        final Set<URL> rets = new LinkedHashSet<URL>();

        try {
            rootFile = new File(rootDirResource.toURI());
        } catch (final URISyntaxException e) {
            LOGGER.log(Level.ERROR, "cat not resolve the rootFile", e);
            throw new RuntimeException("cat not resolve the rootFile", e);
        }
        String fullPattern = StringUtils.replace(rootFile.getAbsolutePath(), File.separator, "/");

        if (!subPattern.startsWith("/")) {
            fullPattern += "/";
        }
        final String filePattern = fullPattern + StringUtils.replace(subPattern, File.separator, "/");

        @SuppressWarnings("unchecked") final Collection<File> files = FileUtils.listFiles(rootFile, new IOFileFilter() {
            @Override
            public boolean accept(final File dir, final String name) {
                return true;
            }

            @Override
            public boolean accept(final File file) {

                if (file.isDirectory()) {
                    return false;
                }
                if (AntPathMatcher.match(filePattern, StringUtils.replace(file.getAbsolutePath(), File.separator, "/"))) {
                    return true;
                }
                return false;
            }
        }, TrueFileFilter.INSTANCE);

        try {
            for (File file : files) {
                rets.add(file.toURI().toURL());
            }
        } catch (final Exception e) {
            LOGGER.log(Level.ERROR, "convert file to URL error", e);
            throw new RuntimeException("convert file to URL error", e);
        }

        return rets;
    }
29709
public static String subPath(String rootDir, File file) {
		try {
			return subPath(rootDir, file.getCanonicalPath());
		} catch (IOException e) {
			throw new IORuntimeException(e);
		}
	}
1186434
@javax.annotation.Nonnull
  public static File findFile(@javax.annotation.Nonnull final String path) {
    for (final File root : com.simiacryptus.util.lang.CodeUtil.codeRoots) {
      @javax.annotation.Nonnull final File file = new File(root, path);
      if (file.exists()) return file;
    }
    throw new RuntimeException(String.format("Not Found: %s; Project Roots = %s", path, com.simiacryptus.util.lang.CodeUtil.codeRoots));
  }
407231
public static String findIconUrl( AbstractApplication app ) {

		StringBuilder sb = new StringBuilder();
		File iconFile = findIcon( app );
		if( iconFile != null ) {
			sb.append( "/" );
			sb.append( app.getName());

			if( app instanceof ApplicationTemplate ) {
				sb.append( "/" );
				sb.append(((ApplicationTemplate) app).getVersion());
			}

			sb.append( "/" );
			sb.append( iconFile.getName());
		}

		return sb.toString();
	}
230878
private static File getJdkHomeDir(@Nullable String baseDirectoryPath,
      @Nullable String homeDirPath, String vmConfigName)
          throws InvalidConfigurationException {
    if (homeDirPath == null) {
      File baseDirectory = getBaseDirectory(baseDirectoryPath);
      File homeDir = new File(baseDirectory, vmConfigName);
      checkConfiguration(homeDir.isDirectory(), "%s is not a directory", homeDir);
      return homeDir;
    } else {
      File potentialHomeDir = new File(homeDirPath);
      if (potentialHomeDir.isAbsolute()) {
        checkConfiguration(potentialHomeDir.isDirectory(), "%s is not a directory",
            potentialHomeDir);
        return potentialHomeDir;
      } else {
        File baseDirectory = getBaseDirectory(baseDirectoryPath);
        File homeDir = new File(baseDirectory, homeDirPath);
        checkConfiguration(homeDir.isDirectory(), "%s is not a directory", potentialHomeDir);
        return homeDir;
      }
    }
  }
1164373
private String getStoredBundlePath(String rootDir, String bundleName) {
		if (bundleName.indexOf('/') != -1) {
			bundleName = bundleName.replace('/', File.separatorChar);
		}

		if (!bundleName.startsWith(File.separator)) {
			rootDir += File.separator;
		}

		return rootDir + PathNormalizer.escapeToPhysicalPath(bundleName);
	}
66990
public static Map<Component,File> findScopedInstancesDirectories( AbstractApplication absApp ) {

		Map<Component,File> result = new HashMap<> ();
		for( Component c : ComponentHelpers.findAllComponents( absApp.getGraphs())) {

			// Target?
			if( ! ComponentHelpers.isTarget( c ))
				continue;

			// Is there a resources directory?
			File dir = ResourceUtils.findInstanceResourcesDirectory( absApp.getDirectory(), c );
			if( ! dir.exists())
				continue;

			result.put( c, dir );
		}

		return result;
	}
154880
public @CheckForNull FilePath getWorkspaceRoot() {
        FilePath r = getRootPath();
        if(r==null) return null;
        return r.child(WORKSPACE_ROOT);
    }
1166082
private function getResourcePathFromBundle($rootDir, $name, $class)
    {
        if ('Contao\CoreBundle\HttpKernel\Bundle\ContaoModuleBundle' === $class) {
            $path = sprintf('%s/system/modules/%s', $rootDir, $name);
        } else {
            $path = $this->getResourcePathFromClassName($class);
        }

        if (null !== $path && is_readable($file = $path . '/config/' . $this->fileName)) {
            return $file;
        }

        return null;
    }
1106898
@SuppressWarnings("unchecked")
	@Override
	public boolean isDirectory(String path) {
		Set<String> paths = context.getResourcePaths(path);
		return (null != paths && paths.size() > 0);
	}
593885
INodeFile getFileINode(String src) {
    byte[][] components = INodeDirectory.getPathComponents(src);
    readLock();
    try {
      INode inode = rootDir.getNode(components);
      if (inode == null || inode.isDirectory())
        return null;
      return (INodeFile)inode;
    } finally {
      readUnlock();
    }
  }