ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: Access source file from mapper
Date Mon, 11 Dec 2006 07:47:03 GMT
As the manual sais about file mappers [1], you have to implement [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;
    exifName = getNameByExifInfo( jpgFile );  // your work ;-)
    self.addMappedName( exifName );



>-----Urspr√ľngliche Nachricht-----
>Von: Patrick Martin [] 
>Gesendet: Freitag, 8. Dezember 2006 18:14
>An: Ant User
>Betreff: Access source file from mapper
>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...
>To unsubscribe, e-mail: For 
>additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message