incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r759467 - /incubator/sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java
Date Sat, 28 Mar 2009 14:25:18 GMT
Author: cziegeler
Date: Sat Mar 28 14:25:18 2009
New Revision: 759467

URL: http://svn.apache.org/viewvc?rev=759467&view=rev
Log:
SLING-876 : Handle optional target path on resource configuration when searching a resource.

Modified:
    incubator/sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java

Modified: incubator/sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java?rev=759467&r1=759466&r2=759467&view=diff
==============================================================================
--- incubator/sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java
(original)
+++ incubator/sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java
Sat Mar 28 14:25:18 2009
@@ -369,7 +369,16 @@
             final Iterator i = resources.iterator();
             while ( dir == null && i.hasNext() ) {
                 final Resource rsrc = (Resource)i.next();
-                dir = new File(rsrc.getDirectory(), path);
+                String child = path;
+                // if resource mapping defines a target path: remove target path from checked
resource path
+                String targetPath = rsrc.getTargetPath();
+                if ( targetPath != null && !targetPath.endsWith("/") ) {
+                    targetPath = targetPath + "/";
+                }
+                if ( targetPath != null && path.startsWith(targetPath) ) {
+                    child = child.substring(targetPath.length());
+                }
+                dir = new File(rsrc.getDirectory(), child);
                 if ( !dir.exists() ) {
                     dir = null;
                 }



Mime
View raw message