fix os error

This commit is contained in:
Daniel Gavin
2021-04-14 02:20:05 +02:00
parent cb4b7efd3e
commit c46317c00b
3 changed files with 13 additions and 4 deletions
+9 -1
View File
@@ -5,6 +5,8 @@ import "core:odin/format"
import "core:fmt"
import "core:strings"
import "core:path/filepath"
import "core:time"
import "core:mem"
import "flag"
@@ -51,6 +53,8 @@ walk_files :: proc(info: os.File_Info, in_err: os.Errno) -> (err: os.Errno, skip
main :: proc() {
init_global_temporary_allocator(mem.megabytes(100));
args: Args;
if len(os.args) < 2 {
@@ -65,6 +69,8 @@ main :: proc() {
path := os.args[len(os.args)-1];
tick_time := time.tick_now();
if os.is_file(path) {
if _, ok := args.write.(bool); ok {
@@ -122,12 +128,14 @@ main :: proc() {
}
} else {
fmt.eprintf("failed to format %v", file);
}
free_all(context.temp_allocator);
}
fmt.printf("formatted %v files", len(files));
fmt.printf("formatted %v files in %vms", len(files), time.duration_milliseconds(time.tick_lap_time(&tick_time)));
}