commit be7920c2e0b21ce944b759feccf6037c2f4b7e1a
parent 2c867e7e48c1813f6855cd5391e6292ad6a3d785
Author: Drew DeVault <sir@cmpwn.com>
Date: Wed, 9 Feb 2022 08:45:46 +0100
hare::module: fix default HAREPATH
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/hare/module/context.ha b/hare/module/context.ha
@@ -33,21 +33,25 @@ export fn context_init(tags: []tag, defs: []str, harepath: str) context = {
defines = defs,
paths = match (os::getenv("HAREPATH")) {
case void =>
- yield alloc([
- strings::dup(harepath),
- strings::dup(dirs::data("hare")),
- strings::dup("vendor"),
- strings::dup("."),
- ]);
+ // TODO: Use strings::tokenize here
+ let sl = strings::split(harepath, ":");
+ defer free(sl);
+ let path: []str = alloc([], len(sl) + 1);
+ for (let i = 0z; i < len(sl); i += 1) {
+ append(path, strings::dup(sl[i]));
+ };
+ append(path, strings::dup("vendor"));
+ append(path, strings::dup("."));
+ yield path;
case let s: str =>
let sl = strings::split(s, ":");
+ defer free(sl);
let path: []str = alloc([], len(sl) + 1);
for (let i = 0z; i < len(sl); i += 1) {
append(path, strings::dup(sl[i]));
};
append(path, strings::dup("vendor"));
append(path, strings::dup("."));
- free(sl);
yield path;
},
cache: str = match (os::getenv("HARECACHE")) {