As the manual sais about file mappers [1], you have to implement
org.apache.tools.ant.util.FileNameMapper [2]. Basically to setters for your own
parametrization and - most important - the map-method
/**
* Returns an array containing the target filename(s) for the
* given source file.
*
* <p>if the given rule doesn't apply to the source file,
* implementation must return null. SourceFileScanner will then
* omit the source file in question.</p>
*
* @param sourceFileName the name of the source file relative to
* some given basedirectory.
* @return an array of strings if the ruld applies to the source file, or
* null if it does not.
*/
String[] mapFileName(String sourceFileName);
With Ant 1.7 you could also use a <scriptmapper>:
<scriptmapper language="javascript">
jpgFile = new java.io.File(source);
exifName = getNameByExifInfo( jpgFile ); // your work ;-)
self.addMappedName( exifName );
</scriptmapper>
Jan
[1] http://ant.apache.org/manual-rc/CoreTypes/mapper.html
[2]
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/FileNameMapper.java?view=markup
>-----Ursprüngliche Nachricht-----
>Von: Patrick Martin [mailto:[EMAIL PROTECTED]
>Gesendet: Freitag, 8. Dezember 2006 18:14
>An: Ant User
>Betreff: Access source file from mapper
>
>Hello,
>
>I am trying to develop a file name mapper which modifies the
>file name according to the file content.
>The idea is to map JPEG file names according to the image EXIF
>attributes (date, size, ...).
>
>The issue I encounter is that the mapper does not have access
>to the source File object, and thus cannot read the file. Is
>there a way around this?
>
>I would like to avoid *looping* (ant-contrib <for>) on source
>files, getting their respective EXIF attributes and
>copying/renaming accordingly...
>
>Thanks,
>
>Patrick
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED] For
>additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]