No global for working dir

This commit is contained in:
Riyyi
2026-08-06 22:11:37 +02:00
parent 8eeeca0d90
commit 70ec4fc9c7
3 changed files with 11 additions and 18 deletions
+2 -12
View File
@@ -5,22 +5,12 @@ import "core:os"
// -----------------------------------------
working_dir: string
// -----------------------------------------
store_working_dir :: proc(allocator := context.allocator) {
get_working_dir :: proc(allocator := context.allocator) -> string {
wd, err := os.get_working_directory(allocator)
if err != nil {
fmt.eprintln("error: get working directory failed:", err)
os.exit(1)
}
working_dir = wd
}
remove_working_dir :: proc(allocator := context.allocator) {
if working_dir != "" {
delete(working_dir, allocator)
working_dir = ""
}
return wd
}