Allocate return value on provided allocator

This commit is contained in:
Jeroen van Rijn
2025-06-05 15:16:35 +02:00
parent 8cd5d01dad
commit da3b3a4139
+4 -4
View File
@@ -10,12 +10,12 @@ user_cache_dir :: proc(allocator: runtime.Allocator) -> (dir: string, err: Error
case .Windows: case .Windows:
dir = get_env("LocalAppData", temp_allocator) dir = get_env("LocalAppData", temp_allocator)
if dir != "" { if dir != "" {
dir = clone_string(dir, temp_allocator) or_return dir = clone_string(dir, allocator) or_return
} }
case .Darwin: case .Darwin:
dir = get_env("HOME", temp_allocator) dir = get_env("HOME", temp_allocator)
if dir != "" { if dir != "" {
dir = concatenate({dir, "/Library/Caches"}, temp_allocator) or_return dir = concatenate({dir, "/Library/Caches"}, allocator) or_return
} }
case: // All other UNIX systems case: // All other UNIX systems
dir = get_env("XDG_CACHE_HOME", allocator) dir = get_env("XDG_CACHE_HOME", allocator)
@@ -24,7 +24,7 @@ user_cache_dir :: proc(allocator: runtime.Allocator) -> (dir: string, err: Error
if dir == "" { if dir == "" {
return return
} }
dir = concatenate({dir, "/.cache"}, temp_allocator) or_return dir = concatenate({dir, "/.cache"}, allocator) or_return
} }
} }
if dir == "" { if dir == "" {
@@ -49,7 +49,7 @@ user_config_dir :: proc(allocator: runtime.Allocator) -> (dir: string, err: Erro
dir = concatenate({dir, "/.config"}, allocator) or_return dir = concatenate({dir, "/.config"}, allocator) or_return
} }
case: // All other UNIX systems case: // All other UNIX systems
dir = get_env("XDG_CONFIG_HOME", allocator) dir = get_env("XDG_CONFIG_HOME", temp_allocator)
if dir == "" { if dir == "" {
dir = get_env("HOME", temp_allocator) dir = get_env("HOME", temp_allocator)
if dir == "" { if dir == "" {