fix: Handled mk_dir error.

This commit is contained in:
2026-06-24 13:42:29 -04:00
parent dc72ff56fd
commit de1594d9d1
2 changed files with 4 additions and 3 deletions

View File

@@ -16,8 +16,6 @@
8. **cmd_restore.odin:20-30 & cmd_remove.odin:19-29** — Identical path-resolution block copy-pasted. `is_abs` guard is redundant since `filepath.abs` is a no-op on absolute paths. Extract a helper.
9. **cmd_restore.odin:44**`os.mkdir_all` error silently discarded. Subsequent write failure will be confusing.
10. **config.odin:178**`search_paths` silently ignores `os.user_home_dir` error. If home is empty, `~` isn't expanded. Same class of bug as issue 3.
12. Consistently ignore allocator errors

View File

@@ -42,7 +42,10 @@ cmd_restore :: proc(cmd: ^Command) {
}
dir := filepath.dir(file.Path)
os.mkdir_all(dir)
if err := os.mkdir_all(dir); err != nil {
fmt.wprintf(cmd.err, "failed to create directory: %s\n", err)
return
}
write_err := os.write_entire_file(file.Path, file.contents)
if write_err != nil {