o Restored basedir alignment

git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@774925 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-05-14 21:02:10 +00:00
parent f60ebacbd4
commit c456055883
1 changed files with 20 additions and 0 deletions

View File

@ -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;
}
}