当前位置: 首页>>代码示例>>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;未经允许,请勿转载。