| 1 | From 04fb25e334492432c0c1a09e1abb4c506fb1e710 Mon Sep 17 00:00:00 2001
|
| 2 | Message-ID: <04fb25e334492432c0c1a09e1abb4c506fb1e710.1754429792.git.lilah@lunabee.space>
|
| 3 | From: Lilah Tascheter <[email protected]>
|
| 4 | Date: Tue, 5 Aug 2025 16:35:24 -0500
|
| 5 | Subject: [PATCH] dirs::xdg: Fallback to cwd.
|
| 6 |
|
| 7 | Guix builds take place without a valid HOME, which will immediately prevent hare
|
| 8 | from functioning. Provide a usable, if unfortunate, default.
|
| 9 | ---
|
| 10 | dirs/xdg.ha | 7 ++++++-
|
| 11 | 1 file changed, 6 insertions(+), 1 deletion(-)
|
| 12 |
|
| 13 | diff --git a/dirs/xdg.ha b/dirs/xdg.ha
|
| 14 | index 9dc6c3b9..65eb92db 100644
|
| 15 | |
| 16 | |
| 17 | @@ -29,7 +29,12 @@ fn lookup(prog: str, var: str, default: str) str = {
|
| 18 | case void => void;
|
| 19 | };
|
| 20 |
|
| 21 | - const home = os::getenv("HOME") as str;
|
| 22 | + let home = os::getenv("HOME") as str;
|
| 23 | + if(match(os::stat(home)) {
|
| 24 | + case let err: fs::error => yield true;
|
| 25 | + case let st: fs::filestat => yield !fs::isdir(st.mode);
|
| 26 | + }){ home = "."; };
|
| 27 | +
|
| 28 | const path = path::set(&buf, home, default, prog)!;
|
| 29 | match (os::mkdirs(path, 0o755)) {
|
| 30 | case let err: fs::error =>
|
| 31 | --
|
| 32 | 2.50.0
|
| 33 |
|