From c4560558838b320604eb814560125235b76e6bc0 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Thu, 14 May 2009 21:02:10 +0000 Subject: [PATCH] o Restored basedir alignment git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@774925 13f79535-47bb-0310-9956-ffa450edef68 --- .../PluginParameterExpressionEvaluator.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java index 4504a9ea0d..e7ec44ea28 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java @@ -344,6 +344,26 @@ public class PluginParameterExpressionEvaluator public File alignToBaseDirectory( File file ) { + // TODO: Copied from the DefaultInterpolator. We likely want to resurrect the PathTranslator or at least a + // similar component for re-usage + if ( file != null ) + { + if ( file.isAbsolute() ) + { + // path was already absolute, just normalize file separator and we're done + } + else if ( file.getPath().startsWith( File.separator ) ) + { + // drive-relative Windows path, don't align with project directory but with drive root + file = file.getAbsoluteFile(); + } + else + { + // an ordinary relative path, align with project directory + file = new File( new File( basedir, file.getPath() ).toURI().normalize() ).getAbsoluteFile(); + } + } return file; } + }