hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit c69716e86461c93f9069b779c4eed9d7cd2b60f4
parent 0ec16736fd23f8094c1ccc0736d211ec812c61fa
Author: Simon Ser <contact@emersion.fr>
Date:   Fri, 27 May 2022 14:36:08 +0000

dirs/xdg: ignore relative paths

The spec says:

> All paths set in these environment variables must be absolute. If an
> implementation encounters a relative path in any of these variables it
> should consider the path invalid and ignore it.

Signed-off-by: Simon Ser <contact@emersion.fr>

Diffstat:
Mdirs/xdg.ha | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/dirs/xdg.ha b/dirs/xdg.ha @@ -15,6 +15,9 @@ fn lookup(prog: str, var: str, default: str) str = { match (os::getenv(var)) { case let s: str => const path = path::add(&buf, s, prog)!; + if (!path::abs(path)) { + yield; + }; match (os::stat(path)) { case let err: fs::error => os::mkdirs(path, 0o755)!;