Updated core lib and did cleanup

Updated core with some path related functions and did some minor code cleanup.
Most of the standard library function is just a matter of copy what is there for the other BSDs.
This commit is contained in:
Andreas T Jonsson
2024-04-18 10:12:42 +02:00
parent 2055f2b933
commit 38640d5d9e
5 changed files with 14 additions and 6 deletions
@@ -1,3 +1,4 @@
//+build freebsd, netbsd
package os
import "core:mem"
+7
View File
@@ -483,6 +483,13 @@ is_dir_path :: proc(path: string, follow_links: bool = true) -> bool {
is_file :: proc {is_file_path, is_file_handle}
is_dir :: proc {is_dir_path, is_dir_handle}
exists :: proc(path: string) -> bool {
runtime.DEFAULT_TEMP_ALLOCATOR_TEMP_GUARD()
cpath := strings.clone_to_cstring(path, context.temp_allocator)
res := _unix_access(cpath, O_RDONLY)
return res == 0
}
// NOTE(bill): Uses startup to initialize it
stdin: Handle = 0