Convert ODIN_OS and ODIN_ARCH to use enums rather than use strings

This commit is contained in:
gingerBill
2022-01-20 19:56:05 +00:00
parent cfbc1a447b
commit 3d7d347192
101 changed files with 341 additions and 310 deletions
+8 -8
View File
@@ -3,13 +3,13 @@ package os2
import "core:strings"
user_cache_dir :: proc(allocator := context.allocator) -> (dir: string, is_defined: bool) {
switch ODIN_OS {
case "windows":
#partial switch ODIN_OS {
case .Windows:
dir = get_env("LocalAppData")
if dir != "" {
dir = strings.clone(dir, allocator)
}
case "darwin":
case .Darwin:
dir = get_env("HOME")
if dir != "" {
dir = strings.concatenate({dir, "/Library/Caches"}, allocator)
@@ -29,13 +29,13 @@ user_cache_dir :: proc(allocator := context.allocator) -> (dir: string, is_defin
}
user_config_dir :: proc(allocator := context.allocator) -> (dir: string, is_defined: bool) {
switch ODIN_OS {
case "windows":
#partial switch ODIN_OS {
case .Windows:
dir = get_env("AppData")
if dir != "" {
dir = strings.clone(dir, allocator)
}
case "darwin":
case .Darwin:
dir = get_env("HOME")
if dir != "" {
dir = strings.concatenate({dir, "/Library/Application Support"}, allocator)
@@ -56,8 +56,8 @@ user_config_dir :: proc(allocator := context.allocator) -> (dir: string, is_defi
user_home_dir :: proc() -> (dir: string, is_defined: bool) {
env := "HOME"
switch ODIN_OS {
case "windows":
#partial switch ODIN_OS {
case .Windows:
env = "USERPROFILE"
}
if v := get_env(env); v != "" {