# Cache: introduce prefixes to manifests · gitcafe/zig

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

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

Visibility: public

Requested revision: 21bd13626d66c36c327bb317bd09cad979d92327

Requested commit: 21bd13626d66c36c327bb317bd09cad979d92327

Commit: 21bd13626d66c36c327bb317bd09cad979d92327

Tree: 0339aef23b4655448e6a71cdfca1840f66c69092

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
Cache: introduce prefixes to manifests

Before, cache manifest files would have absolute file paths. This is
problematic for two reasons:

 * Absolute file paths are not portable. Some operating systems such as
   WASI have trouble with them. The files themselves are less portable;
   they cannot be migrated from one user's home directory to another's.
   And finally they can break due to file paths exceeding maximum path
   component size.
 * They would prevent some advanced use cases of Zig, where the lib dir
   has a different path in a different invocation but is ultimately the
   same Zig version and lib directory as before.

This commit adds a new column that specifies the prefix directory for
each file. 0 is an escape hatch and has the previous behavior. The other
two prefixes introduced are zig lib directory, and the cache directory.
This means files in zig-cache manifests can reference files local to
these directories.

In practice, this means it is possible to use a different file path for
the zig lib directory in a subsequent run of zig and have it still take
advantage of the global cache, provided that the files inside remain
unchanged.

closes #13050

```

## Parents

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

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