mirror of
https://github.com/sbrow/envr.git
synced 2026-06-27 18:48:33 -04:00
fix: Handled mk_dir error.
This commit is contained in:
2
TODOS.md
2
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.
|
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.
|
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
|
12. Consistently ignore allocator errors
|
||||||
|
|||||||
@@ -42,7 +42,10 @@ cmd_restore :: proc(cmd: ^Command) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dir := filepath.dir(file.Path)
|
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)
|
write_err := os.write_entire_file(file.Path, file.contents)
|
||||||
if write_err != nil {
|
if write_err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user