org.apache.tools.ant.taskdefs

Class Basename

public class Basename extends Task

Sets a property to the base name of a specified file, optionally minus a suffix. This task can accept the following attributes: The file and property attributes are required. The suffix attribute can be specified either with or without the ".", and the result will be the same (ie., the returned file name will be minus the .suffix).

When this task executes, it will set the specified property to the value of the last element in the specified file. If file is a directory, the basename will be the last directory element. If file is a full-path filename, the basename will be the simple file name. If a suffix is specified, and the specified file ends in that suffix, the basename will be the simple file name without the suffix.

Since: Ant 1.5

UNKNOWN: category="property"

Method Summary
voidexecute()
do the work
voidsetFile(File file)
file or directory to get base name from
voidsetProperty(String property)
Property to set base name to.
voidsetSuffix(String suffix)
Optional suffix to remove from base name.

Method Detail

execute

public void execute()
do the work

Throws: BuildException if required attributes are not supplied property and attribute are required attributes

setFile

public void setFile(File file)
file or directory to get base name from

Parameters: file file or directory to get base name from

setProperty

public void setProperty(String property)
Property to set base name to.

Parameters: property name of property

setSuffix

public void setSuffix(String suffix)
Optional suffix to remove from base name.

Parameters: suffix suffix to remove from base name

Copyright B) 2000-2007 Apache Software Foundation. All Rights Reserved.