summaryrefslogtreecommitdiff
path: root/source/kit/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/kit/file.c')
-rw-r--r--source/kit/file.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/kit/file.c b/source/kit/file.c
index 07e18f4..10f4857 100644
--- a/source/kit/file.c
+++ b/source/kit/file.c
@@ -36,9 +36,9 @@ static i32 is_delim(char c) {
return c == '/' || c == '\\';
}
-static kit_str_builder_t kit_get_env_(char *name,
- kit_allocator_t *alloc) {
- char *val = getenv(name);
+kit_str_builder_t kit_get_env(kit_str_t name,
+ kit_allocator_t *alloc) {
+ char *val = getenv(BS(name));
i64 size = val != NULL ? (i64) strlen(val) : 0;
str_builder_t result;
@@ -138,7 +138,7 @@ kit_str_builder_t kit_path_join(kit_str_t left, kit_str_t right,
}
kit_str_builder_t kit_path_user(kit_allocator_t *alloc) {
- kit_str_builder_t user = kit_get_env_(KIT_ENV_HOME, alloc);
+ kit_str_builder_t user = kit_get_env(SZ(KIT_ENV_HOME), alloc);
if (user.size == 0) {
DA_RESIZE(user, 1);
if (user.size == 1)
@@ -150,7 +150,7 @@ kit_str_builder_t kit_path_user(kit_allocator_t *alloc) {
kit_str_builder_t kit_path_cache(kit_allocator_t *alloc) {
kit_str_builder_t cache, user;
- cache = kit_get_env_("XDG_CACHE_HOME", alloc);
+ cache = kit_get_env(SZ("XDG_CACHE_HOME"), alloc);
if (cache.size != 0)
return cache;
DA_DESTROY(cache);
@@ -178,13 +178,13 @@ kit_str_builder_t kit_path_cache(kit_allocator_t *alloc) {
kit_str_builder_t kit_path_data(kit_allocator_t *alloc) {
kit_str_builder_t data, user;
- data = kit_get_env_("XDG_DATA_HOME", alloc);
+ data = kit_get_env(SZ("XDG_DATA_HOME"), alloc);
if (data.size != 0)
return data;
DA_DESTROY(data);
#if defined(_WIN32) && !defined(__CYGWIN__)
- data = kit_get_env_("LOCALAPPDATA", alloc);
+ data = kit_get_env(SZ("LOCALAPPDATA"), alloc);
if (data.size != 0)
return data;
DA_DESTROY(data);