Java Code Examples for org.codehaus.plexus.util.FileUtils#filename()

The following examples show how to use org.codehaus.plexus.util.FileUtils#filename() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NativeLinkMojo.java    From maven-native with MIT License 6 votes vote down vote up
private List<String> getLibFileNames()
    throws MojoExecutionException
{
    List<String> libList = new ArrayList<>();

    Set<Artifact> artifacts = this.project.getArtifacts();

    for ( Iterator<Artifact> iter = artifacts.iterator(); iter.hasNext(); )
    {
        Artifact artifact = iter.next();

        if ( INCZIP_TYPE.equals( artifact.getType() ) )
        {
            continue;
        }

        String libFileName = FileUtils.filename( this.getDependencyFile( artifact, true ).getPath() );

        libList.add( libFileName );
    }

    libList = this.reorderLibDependencies( libList );

    return libList;
}
 
Example 2
Source File: ThemeBuilderUtils.java    From rice with Educational Community License v2.0 6 votes vote down vote up
/**
 * Indicates whether there is a file with the given name within the given directory
 *
 * @param directory directory to check for file
 * @param fileName name of the file to check for
 * @return true if there is a file in the directory, false if not
 */
public static boolean directoryContainsFile(File directory, String fileName) {
    boolean containsFile = false;

    List<String> directoryContents = getDirectoryContents(directory, null, null);

    for (String directoryFile : directoryContents) {
        String directoryFilename = FileUtils.filename(directoryFile);

        if (directoryFilename.equals(fileName)) {
            containsFile = true;
        }
    }

    return containsFile;
}
 
Example 3
Source File: NativeLinkMojo.java    From maven-native with MIT License 5 votes vote down vote up
/**
 * convert dependencyLinkingOrders to a file list
 *
 * @return
 */
private List<String> getDependenciesFileOrderList()
    throws MojoExecutionException
{
    List<String> list = new ArrayList<>();

    if ( this.linkingOrderLibs != null )
    {
        for ( Iterator<String> i = linkingOrderLibs.iterator(); i.hasNext(); )
        {
            String element = i.next();

            Artifact artifact = lookupDependencyUsingGroupArtifactIdPair( element );

            if ( artifact != null )
            {
                String libFileName = FileUtils.filename( this.getDependencyFile( artifact, false ).getPath() );

                list.add( libFileName );
            }
            else
            {
                throw new MojoExecutionException( element + " not found on project dependencies." );
            }
        }
    }

    return list;
}