# task: Add ZED_RELATIVE_DIR task variable \(\#31657\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/ae076fa415fd8c859b4414c3a5839a5addd90351)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: ae076fa415fd8c859b4414c3a5839a5addd90351

Requested commit: ae076fa415fd8c859b4414c3a5839a5addd90351

Commit: ae076fa415fd8c859b4414c3a5839a5addd90351

Tree: e643d3567eff38f275c812a38f20e3bd195b454b

Author: Dhruvin Gandhi

Committer: GitHub

## Message

```
task: Add ZED_RELATIVE_DIR task variable (#31657)

This is my first contribution to zed, let me know if I missed anything.

There is no corresponding issue/discussion.

`$ZED_RELATIVE_DIR` can be used in cases where a task's command's
filesystem namespace (e.g. inside a container) is different than the
host, where absolute paths cannot work.

I modified `relative_path` to `relative_file` after the addition of
`relative_dir`.

For top-level files, where `relative_file.parent() == Some("")`, I use
`"."` for `$ZED_RELATIVE_DIR`, which is a valid relative path in both
*nix and windows.

Thank you for building zed, and open-sourcing it. I hope to contribute
more as I use it as my primary editor.

Release Notes:

- Added ZED_RELATIVE_DIR (path to current file's directory relative to
worktree root) task variable.
```

## Parents

- [b4af61edfe43ca17fdc973b3bcdccb4263d12105](https://git.cafe/gitcafe/zed/commit/b4af61edfe43ca17fdc973b3bcdccb4263d12105?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/ae076fa415fd8c859b4414c3a5839a5addd90351?format=markdown)
