B.5 AvailableTask
Prev | Appendix B. Core tasks | Next

## B.5 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 existance 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.6: Attributes

Name | Type | Description | Default | Required
--- | --- | --- | --- | ---
`property` | `String` | Name of the property that is to be set. | n/a | Yes
`value` | `String` | The value the property is to be set to. | `"true"` | No
`file` | `String` | File/directory to check existence. | n/a | Yes (or `resource` or `extension`)
`resource` | `String` | Path of the resource to look for. | n/a | Yes (or `file` or `extension`)
`extension` | `String` | Name of the extension to look for. | n/a | Yes (or `file` or `resource`)
`type` | `String` (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/a | No
`filepath` | `String` | The path to use when looking up `file`. | n/a | No
`followSymlinks` | `Boolean` | Whether to dereference symbolic links when looking up `file`. | `false` | No

### B.5.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" />

Prev | Up | Next
B.4 ApplyTask | Home | B.6 ChmodTask