# Use \`std.fs.path.relative\` for \`@import\` and \`@embedFile\` sub paths · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/0527cab71bac6067ceae6a1fb0a0f401a5027607)

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

Visibility: public

Requested revision: 0527cab71bac6067ceae6a1fb0a0f401a5027607

Requested commit: 0527cab71bac6067ceae6a1fb0a0f401a5027607

Commit: 0527cab71bac6067ceae6a1fb0a0f401a5027607

Tree: 025db0799e40c1489ce51f68fc28b60d14c45718

Author: Ryan Liptak

Committer: Veikka Tuominen

## Message

```
Use `std.fs.path.relative` for `@import` and `@embedFile` sub paths

Fixes edge cases where the `startsWith` that was used previously would return a false positive on a resolved path like `foo.zig` when the resolved root was `foo`. Before this commit, such a path would be treated as a sub path of 'foo' with a resolved sub file path of 'zig' (and the `.` would be assumed to be a path separator). After this commit, `foo.zig` will be correctly treated as outside of the root of `foo`.

Closes #18355

```

## Parents

- [9a1608509300fcdf118d82063bbf1481a10ca551](https://git.cafe/gitcafe/zig/commit/9a1608509300fcdf118d82063bbf1481a10ca551?format=markdown)

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