This commit is contained in:
unintendedfraud
2024-12-08 21:32:21 +01:00
commit a809dc3a9a
5 changed files with 1089 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
package utils
import "core:fmt"
import "core:os"
import "core:strings"
Error :: os.Error
load_file :: proc(path: string) -> ([]string, Error) {
file, open_err := os.open(path)
if open_err != nil {
return nil, open_err
}
defer os.close(file)
content, read_err := os.read_entire_file_or_err(file)
if read_err != nil {
return nil, read_err
}
return strings.split(string(content), "\n"), nil
}