wro4j-maven-plugin/src/main/java/ro/isdc/wro/maven/plugin/support/AggregatedFolderPathResolver.java
public String resolve() {
    notNull(buildDirectory, "Build directory cannot be null!");
    notNull(log, "Logger cannot be null!");
    String result = null;
    final File cssTargetFolder = cssDestinationFolder == null ? destinationFolder : cssDestinationFolder;
    File rootFolder = null;
    notNull(cssTargetFolder, "cssTargetFolder cannot be null!");

    if (buildFinalName != null && cssTargetFolder.getPath().startsWith(buildFinalName.getPath())) {
      rootFolder = buildFinalName;
    } else if (cssTargetFolder.getPath().startsWith(buildDirectory.getPath())) {
      rootFolder = buildDirectory;
    } else {
      // find first best match
      for (final String contextFolder : getContextFolders()) {
        if (cssTargetFolder.getPath().startsWith(contextFolder)) {
          rootFolder = new File(contextFolder);
          break;
        }
      }
    }
    log.debug("buildDirectory: " + buildDirectory);
    log.debug("contextFolders: " + contextFoldersAsCSV);
    log.debug("cssTargetFolder: " + cssTargetFolder);
    log.debug("rootFolder: " + rootFolder);
    if (rootFolder != null) {
      result = StringUtils.removeStart(cssTargetFolder.getPath(), rootFolder.getPath());
    }
    log.debug("computedAggregatedFolderPath: " + result);
    return result;
  }
public String resolve() {
    notNull(buildDirectory, "Build directory cannot be null!");
    notNull(log, "Logger cannot be null!");
    String result = null;
    final File cssTargetFolder = cssDestinationFolder == null ? destinationFolder : cssDestinationFolder;
    File rootFolder = null;
    notNull(cssTargetFolder, "cssTargetFolder cannot be null!");

    if (buildFinalName != null && cssTargetFolder.getPath().startsWith(buildFinalName.getPath())) {
      rootFolder = buildFinalName;
    } else if (cssTargetFolder.getPath().startsWith(buildDirectory.getPath())) {
      rootFolder = buildDirectory;
    } else {
      // find first best match
      for (final String contextFolder : getContextFolders()) {
        if (cssTargetFolder.getPath().startsWith(contextFolder)) {
          rootFolder = new File(contextFolder);
          break;
        }
      }
    }
    log.debug("buildDirectory: " + buildDirectory);
    log.debug("contextFolders: " + contextFoldersAsCSV);
    log.debug("cssTargetFolder: " + cssTargetFolder);
    log.debug("rootFolder: " + rootFolder);
    if (rootFolder != null) {
      result = StringUtils.removeStart(cssTargetFolder.getPath(), rootFolder.getPath());
    }
    log.debug("computedAggregatedFolderPath: " + result);
    return result;
  }
public String resolve ( ) { notNull ( buildDirectory , "Build directory cannot be null!" ) ; notNull ( log , "Logger cannot be null!" ) ; String result = null ; final File cssTargetFolder = cssDestinationFolder == null ? destinationFolder : cssDestinationFolder ; File rootFolder = null ; notNull ( cssTargetFolder , "cssTargetFolder cannot be null!" ) ; if ( buildFinalName != null && cssTargetFolder . getPath ( ) . startsWith ( buildFinalName . getPath ( ) ) ) { rootFolder = buildFinalName ; } else if ( cssTargetFolder . getPath ( ) . startsWith ( buildDirectory . getPath ( ) ) ) { rootFolder = buildDirectory ; } else { // find first best match for ( final String contextFolder : getContextFolders ( ) ) { if ( cssTargetFolder . getPath ( ) . startsWith ( contextFolder ) ) { rootFolder = new File ( contextFolder ) ; break ; } } } log . debug ( "buildDirectory: " + buildDirectory ) ; log . debug ( "contextFolders: " + contextFoldersAsCSV ) ; log . debug ( "cssTargetFolder: " + cssTargetFolder ) ; log . debug ( "rootFolder: " + rootFolder ) ; if ( rootFolder != null ) { result = StringUtils . removeStart ( cssTargetFolder . getPath ( ) , rootFolder . getPath ( ) ) ; } log . debug ( "computedAggregatedFolderPath: " + result ) ; return result ; }
The idea is to compute the aggregatedFolderPath based on a root folder. The root folder is determined by comparing
the cssTargetFolder (the folder where aggregated css files are located) with build directory or contextFolder. If
rootFolder is null, then the result is also null (equivalent to using the cssTargetFolder the same as the root
folder.

@return the aggregated folder path, based on the cssDestinationFolder (if set) and the build folder or the
contextFolder.
The idea is to compute the aggregatedFolderPath based on a root folder . The root folder is determined by comparing the cssTargetFolder ( the folder where aggregated css files are located ) with build directory or contextFolder . If rootFolder is null then the result is also null ( equivalent to using the cssTargetFolder the same as the root folder .