From de1594d9d1fe46dd9ebc3be01fc5a5ebaf4064e5 Mon Sep 17 00:00:00 2001 From: Spencer Brower Date: Wed, 24 Jun 2026 13:42:29 -0400 Subject: [PATCH] fix: Handled mk_dir error. --- TODOS.md | 2 -- cmd_restore.odin | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/TODOS.md b/TODOS.md index 7f96bbc..9f4af3b 100644 --- a/TODOS.md +++ b/TODOS.md @@ -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 diff --git a/cmd_restore.odin b/cmd_restore.odin index 01e98b4..925ae2c 100644 --- a/cmd_restore.odin +++ b/cmd_restore.odin @@ -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 {