Fix leaks
This commit is contained in:
+5
-7
@@ -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 = ""
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user