B.6 AvailableTask

Available Task tests if a resource/file is set and sets a certain property to a certain value if it exists.

Here, AvailableTask first checks for the existence of either file or directory named test.txt in /tmp. Then, it checks for the directory foo in /home and then for the file or directory bar in /home/foo. If /tmp/test.txt is found, the property test_txt_exists is set to "Yes", if /home/foo is found and a directory, properties.yetanother is set to "true" (default). If /home/foo/bar exists, AvailableTask will set foo.bar to "Well, yes". And last it checks if extension foo is loaded, so the property foo.ext.loaded is set to "true" (default).

NB: the Available task can also be used as a condition, see conditions.

Table B.8: Attributes

propertyStringName of the property that is to be set.n/aYes
valueStringThe value the property is to be set to."true"No
fileStringFile/directory to check existence.n/aYes (or resource or extension)
resourceStringPath of the resource to look for.n/aYes (or file or extension)
extensionStringName of the extension to look for.n/aYes (or file or resource)
typeString (file|dir)Determines if AvailableTask should look for a file or a directory at the position set by file. If empty, it checks for either file or directory.n/aNo
filepathStringThe path to use when looking up file.n/aNo
followSymlinksBooleanWhether to dereference symbolic links when looking up file.falseNo

B.6.1 Examples

<available file="/tmp/test.txt" property="test_txt_exists" value="Yes"/>

<available file="/home/foo" type="dir" property="properties.yetanother" />

<available file="/home/foo/bar" property="foo.bar" value="Well, yes" />