Fix leaks

This commit is contained in:
Riyyi
2026-08-03 21:12:37 +02:00
parent 7c71b82b10
commit 7e3762a442
6 changed files with 24 additions and 71 deletions
+5 -7
View File
@@ -3,14 +3,12 @@ package file
import "core:fmt"
import "core:os"
// TODO:
// - list files in directory
// - get relative path
// - read file contents
// - write file contents
// -----------------------------------------
working_dir: string
// -----------------------------------------
store_working_dir :: proc(allocator := context.allocator) {
wd, err := os.get_working_directory(allocator)
if err != nil {
@@ -20,9 +18,9 @@ store_working_dir :: proc(allocator := context.allocator) {
working_dir = wd
}
remove_working_dir :: proc() {
remove_working_dir :: proc(allocator := context.allocator) {
if working_dir != "" {
delete(working_dir)
delete(working_dir, allocator)
working_dir = ""
}
}