# paths: plugin run inside a plugin finds the plugins root \(\#147\) · lucenx/signaltty

[View on GitCafe](https://git.cafe/lucenx/signaltty/commit/0910eb58236bf749010023803c5d7a3da81745ef)

Repository: [lucenx/signaltty](https://git.cafe/lucenx/signaltty)

Visibility: public

Requested revision: 0910eb58236bf749010023803c5d7a3da81745ef

Requested commit: 0910eb58236bf749010023803c5d7a3da81745ef

Commit: 0910eb58236bf749010023803c5d7a3da81745ef

Tree: 37a89768b06858a6132cd687e20a56a58d865157

Author: Simone

Committer: GitHub

## Message

```
paths: plugin run inside a plugin finds the plugins root (#147)

* paths: plugin run inside a plugin finds the plugins root

Hooks and plugin commands get SIGNALTTY_PLUGIN_DIR set to their own
package dir, but paths::plugin_dir() reads the same variable as the
plugins root. A nested `signaltty plugin run` from a hook or command
then scanned <root>/<name>/*/plugin.toml and failed with 'no such
plugin'. When SIGNALTTY_PLUGIN_NAME names the dir's last component,
resolve the root as its parent.

* paths: resolve a relative plugin root before commands change cwd

A relative SIGNALTTY_PLUGIN_DIR (or server --plugin-dir) was exported
as-is to plugin commands and hooks, which run from their package dir,
so a nested `signaltty plugin run` looked in <root>/<name>/<root>.
Make both absolute up front; add a CLI test for the relative root.

---------

Co-authored-by: Grok Bot <grok-bot@x.ai>
```

## Parents

- [1d60fec13c07fdfd033c2724ba7b02118b91aa87](https://git.cafe/lucenx/signaltty/commit/1d60fec13c07fdfd033c2724ba7b02118b91aa87?format=markdown)

[Source at this commit](https://git.cafe/lucenx/signaltty/tree/0910eb58236bf749010023803c5d7a3da81745ef?format=markdown)
