ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Nabbefeld <Peter.Nabbef...@gmx.de>
Subject Re: os-independent directory mapping in copy task?
Date Thu, 24 Mar 2005 11:34:18 GMT

Thank You very much. I've tried the handledirchar attribute with ant 
1.7alpha - works fine. However, there's one little inconsistency: It 
works with regexpmapper, but it doesn't work with the generic <mapper 
type="regexp" .../>.

Kind regards

Peter Nabbefeld


Peter Reilly schrieb:

> Ant 1.6.3 will add a new attribute to the regexp mapper:
> handledirchar
>    If this is specified, the mapper will treat a \ character in a 
> filename as a / for the purposes of matching.
>    This attribute can be true or false, the default is false. This 
> attribute is useful for cross-platform build files.
>    /Since ant 1.6.3.
> 
> The example given is:
> /
> 
>        <regexpmapper from="${basedir}/d/e/(.*)" to="\1" 
> handledirchar="yes"/>
> 
> And the example is mean to work on both unix and windows.
> 
> Peter
> 
> Peter Nabbefeld wrote:
> 
>>
>> Hello,
>>
>> I'm using the copy task to map a file name into a directory structure:
>>
>> <copy todir="...">
>>     <fileset dir="...">
>>         <include name="**/*.txt"/>
>>     </fileset>
>>     <mapper type="regexp" 
>> from="^([a-zA-Z][a-z_A-Z0-9]*)\\([A-Z][a-zA-Z0-9]*)_([A-Z][a-zA-Z0-9]*)_([A-Z][a-zA-Z0-9]*)_([\w]+).txt$$"

>> to="\1/\2/\3/\4/\5.txt"/>
>> </copy>
>>
>> My problem with this is, that I've to use the backslash with w2k 
>> instead of the url type forward slash, so my script isn't 
>> platform-independent. I'd prefer to use something like
>>
>> <mapper type="regexp" 
>> from="^([a-zA-Z][a-z_A-Z0-9]*)${java.file.separator}([A-Z][a-zA-Z0-9]*)_([A-Z][a-zA-Z0-9]*)_([A-Z][a-zA-Z0-9]*)_([\w]+).txt$$"

>> to="\1/\2/\3/\4/\5.txt"/>
>>
>> This doesn't work. Does anybody know, how to solve this problem?
>>
>> Kind regards
>>
>> Peter nabbefeld
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message