mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-29 02:40:05 +00:00
Convert ODIN_OS and ODIN_ARCH to use enums rather than use strings
This commit is contained in:
@@ -89,7 +89,7 @@ scan_chunk :: proc(pattern: string) -> (star: bool, chunk, rest: string) {
|
||||
scan_loop: for i = 0; i < len(pattern); i += 1 {
|
||||
switch pattern[i] {
|
||||
case '\\':
|
||||
when ODIN_OS != "windows" {
|
||||
when ODIN_OS != .Windows {
|
||||
if i+1 < len(pattern) {
|
||||
i += 1
|
||||
}
|
||||
@@ -161,7 +161,7 @@ match_chunk :: proc(chunk, s: string) -> (rest: string, ok: bool, err: Match_Err
|
||||
chunk = chunk[1:]
|
||||
|
||||
case '\\':
|
||||
when ODIN_OS != "windows" {
|
||||
when ODIN_OS != .Windows {
|
||||
chunk = chunk[1:]
|
||||
if len(chunk) == 0 {
|
||||
err = .Syntax_Error
|
||||
@@ -188,7 +188,7 @@ get_escape :: proc(chunk: string) -> (r: rune, next_chunk: string, err: Match_Er
|
||||
return
|
||||
}
|
||||
chunk := chunk
|
||||
if chunk[0] == '\\' && ODIN_OS != "windows" {
|
||||
if chunk[0] == '\\' && ODIN_OS != .Windows {
|
||||
chunk = chunk[1:]
|
||||
if len(chunk) == 0 {
|
||||
err = .Syntax_Error
|
||||
@@ -231,7 +231,7 @@ glob :: proc(pattern: string, allocator := context.allocator) -> (matches: []str
|
||||
|
||||
dir, file := split(pattern)
|
||||
volume_len := 0
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
volume_len, dir = clean_glob_path_windows(dir, temp_buf[:])
|
||||
} else {
|
||||
dir = clean_glob_path(dir)
|
||||
@@ -308,7 +308,7 @@ _glob :: proc(dir, pattern: string, matches: ^[dynamic]string) -> (m: [dynamic]s
|
||||
|
||||
@(private)
|
||||
has_meta :: proc(path: string) -> bool {
|
||||
when ODIN_OS == "windows" {
|
||||
when ODIN_OS == .Windows {
|
||||
CHARS :: `*?[`
|
||||
} else {
|
||||
CHARS :: `*?[\`
|
||||
|
||||
@@ -8,7 +8,7 @@ import "core:strings"
|
||||
is_separator :: proc(c: byte) -> bool {
|
||||
switch c {
|
||||
case '/': return true
|
||||
case '\\': return ODIN_OS == "windows"
|
||||
case '\\': return ODIN_OS == .Windows
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -32,7 +32,7 @@ volume_name :: proc(path: string) -> string {
|
||||
}
|
||||
|
||||
volume_name_len :: proc(path: string) -> int {
|
||||
if ODIN_OS == "windows" {
|
||||
if ODIN_OS == .Windows {
|
||||
if len(path) < 2 {
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//+build linux, darwin, freebsd
|
||||
package filepath
|
||||
|
||||
when ODIN_OS == "darwin" {
|
||||
when ODIN_OS == .Darwin {
|
||||
foreign import libc "System.framework"
|
||||
} else {
|
||||
foreign import libc "system:c"
|
||||
@@ -54,7 +54,7 @@ foreign libc {
|
||||
@(link_name="free") _unix_free :: proc(ptr: rawptr) ---
|
||||
|
||||
}
|
||||
when ODIN_OS == "darwin" {
|
||||
when ODIN_OS == .Darwin {
|
||||
@(private)
|
||||
foreign libc {
|
||||
@(link_name="__error") __error :: proc() -> ^i32 ---
|
||||
|
||||
Reference in New Issue
Block a user