當前位置: 首頁>>代碼示例>>Java>>正文


Java DirectoryScanner.getIncludedDirectories方法代碼示例

本文整理匯總了Java中org.codehaus.plexus.util.DirectoryScanner.getIncludedDirectories方法的典型用法代碼示例。如果您正苦於以下問題:Java DirectoryScanner.getIncludedDirectories方法的具體用法?Java DirectoryScanner.getIncludedDirectories怎麽用?Java DirectoryScanner.getIncludedDirectories使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.codehaus.plexus.util.DirectoryScanner的用法示例。


在下文中一共展示了DirectoryScanner.getIncludedDirectories方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getSassDirectories

import org.codehaus.plexus.util.DirectoryScanner; //導入方法依賴的package包/類
private String[] getSassDirectories() {
    DirectoryScanner scanner = new DirectoryScanner();
    scanner.setBasedir(sassSourceDirectory);
    scanner.setIncludes(new String[]{"**/sass"});
    scanner.addDefaultExcludes();
    scanner.scan();
    return scanner.getIncludedDirectories();
}
 
開發者ID:learningobjectsinc,項目名稱:sass-maven-plugin,代碼行數:9,代碼來源:CompileSassMojo.java

示例2: getDirectoryContents

import org.codehaus.plexus.util.DirectoryScanner; //導入方法依賴的package包/類
/**
 * Retrieves a list of files and directories that are in the given directory, possibly filtered by the
 * list of include patterns or exclude patterns
 *
 * @param baseDirectory directory to retrieve files and directories from
 * @param includes list of patterns to match against for files to include, can include Ant patterns
 * @param excludes list of patterns to match for excluded files, can include Ant patterns
 * @return list of files within the directory that match all given patterns
 */
public static List<String> getDirectoryContents(File baseDirectory, String[] includes, String[] excludes) {
    List<String> contents = new ArrayList<String>();

    DirectoryScanner scanner = new DirectoryScanner();

    if (includes != null) {
        scanner.setIncludes(includes);
    }

    if (excludes != null) {
        scanner.setExcludes(excludes);
    }

    scanner.setCaseSensitive(false);
    scanner.addDefaultExcludes();
    scanner.setBasedir(baseDirectory);

    scanner.scan();

    for (String includedDirectory : scanner.getIncludedDirectories()) {
        contents.add(includedDirectory);
    }

    for (String includedFilename : scanner.getIncludedFiles()) {
        contents.add(includedFilename);
    }

    return contents;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:39,代碼來源:ThemeBuilderUtils.java

示例3: copyDirectory

import org.codehaus.plexus.util.DirectoryScanner; //導入方法依賴的package包/類
/**
 * Copies all the contents from the directory given by the source path to the directory given by the
 * target path
 *
 * <p>
 * If source directory does not exist nothing is performed. The target directory will be created if it
 * does not exist. Any hidden directories (directory names that start with ".") will be deleted from the
 * target directory
 * </p>
 *
 * @param sourceDirectoryPath absolute path to the source directory
 * @param targetDirectoryPath absolute path to the target directory
 * @throws IOException
 */
public static void copyDirectory(String sourceDirectoryPath, String targetDirectoryPath)
        throws IOException {
    File sourceDir = new File(sourceDirectoryPath);

    if (!sourceDir.exists()) {
        return;
    }

    File targetDir = new File(targetDirectoryPath);
    if (targetDir.exists()) {
        // force removal so the copy starts clean
        FileUtils.forceDelete(targetDir);
    }

    targetDir.mkdir();

    FileUtils.copyDirectoryStructure(sourceDir, targetDir);

    // remove hidden directories from the target
    DirectoryScanner scanner = new DirectoryScanner();
    scanner.setBasedir(targetDir);

    scanner.scan();

    for (String includedDirectory : scanner.getIncludedDirectories()) {
        File subdirectory = new File(targetDir, includedDirectory);

        if (subdirectory.exists() && subdirectory.isDirectory()) {
            if (subdirectory.getName().startsWith(".")) {
                FileUtils.forceDelete(subdirectory);
            }
        }
    }
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:49,代碼來源:ThemeBuilderUtils.java

示例4: cleanReports

import org.codehaus.plexus.util.DirectoryScanner; //導入方法依賴的package包/類
private void cleanReports( File projectFile, String reportDirectory, String toolName, Log log ) 
        throws MojoFailureException
{
    final DirectoryScanner directoryScanner = new DirectoryScanner();
    directoryScanner.setIncludes( new String[]{ "**\\" + reportDirectory } );
    directoryScanner.setBasedir( projectFile.getParentFile() );
    directoryScanner.scan();

    log.info( "Cleaning up " + toolName + " reports" );
    
    for ( String directoryName : directoryScanner.getIncludedDirectories() )
    {
        final File directory = new File( projectFile.getParentFile(), directoryName );
        log.debug( "Deleting directory " + directory );
        
        try
        {
            FileUtils.deleteDirectory( directory );
        }
        catch ( IOException ioe )
        {
            log.error( "Failed to delete directory " + directory );
            throw new MojoFailureException( ioe.getMessage(), ioe );
        }
    }

    log.info( toolName + " report clean-up complete" );
}
 
開發者ID:andi12,項目名稱:msbuild-maven-plugin,代碼行數:29,代碼來源:MSBuildCleanMojo.java


注:本文中的org.codehaus.plexus.util.DirectoryScanner.getIncludedDirectories方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。