Zachary Shilton 830140157d
website: remove obselete nav data (#10811)
* website: remove obselete sidebar_title frontmatter from docs

* website: bump to latest docs-page

* website: update plugin creation and registration docs

* website: fix broken links
2021-03-31 15:07:00 -04:00

39 lines
1.1 KiB
Plaintext

---
page_title: Path Variables - HCL Configuration Language
description: |-
Special variables provide directory information. This page covers all path
variables.
---
# Path variables
- `path.cwd`: the directory from where Packer was started.
- `path.root`: the directory of the input HCL file or the input folder.
## Examples
```HCL
locals {
settings_file = "${path.cwd}/settings.txt"
scripts_folder = "${path.root}/scripts"
root = path.root
}
```
## Related Functions
- [`abspath`](/docs/templates/hcl_templates/functions/file/abspath) takes a string containing
a filesystem path and converts it to an absolute path.
- [`basename`](/docs/templates/hcl_templates/functions/file/basename) returns _only_ the last
portion of a filesystem path, discarding the portion that would be returned
by `dirname`.
- [`fileset`](/docs/templates/hcl_templates/functions/file/fileset) enumerates a set of
regular file names given a path and pattern.
- [`dirname`](/docs/templates/hcl_templates/functions/file/dirname) returns all of the
segments of a filesystem path _except_ the last, discarding the portion that
would be returned by `basename`.