# Fix handling of empty XDG environment variables · gitcafe/zig

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

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

Visibility: public

Requested revision: 0a70455095a19a4c18497e6786ca6139c1cc2892

Requested commit: 0a70455095a19a4c18497e6786ca6139c1cc2892

Commit: 0a70455095a19a4c18497e6786ca6139c1cc2892

Tree: e3b5ca0499e459ac413a2e4152dcae5ad6a9b833

Author: Ian Johnson

Committer: Andrew Kelley

## Message

```
Fix handling of empty XDG environment variables

Closes #21132

According to the XDG Base Directory specification
(https://specifications.freedesktop.org/basedir-spec/latest/#variables),
empty values for these environment variables should be treated the same
as if they are unset. Specifically, for the instances changed in this
commit,

> $XDG_DATA_HOME defines the base directory relative to which
> user-specific data files should be stored. If $XDG_DATA_HOME is either
> not set **or empty**, a default equal to $HOME/.local/share should be
> used.

and

> $XDG_CACHE_HOME defines the base directory relative to which
> user-specific non-essential data files should be stored. If
> $XDG_CACHE_HOME is either not set **or empty**, a default equal to
> $HOME/.cache should be used.

(emphasis mine)

In addition to the case mentioned in the linked issue, all other uses of
XDG environment variables were corrected.

```

## Parents

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

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