refactor: App now crashes if home isn't set.

This commit is contained in:
2026-06-24 14:34:47 -04:00
parent 3331a40053
commit bb6c067b97
2 changed files with 6 additions and 6 deletions

View File

@@ -14,8 +14,6 @@
7. Make sure official path separators are used when appropriate, rather than '/'.
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
13. **cmd_sync.odin:80, cmd_list.odin:33**`make([]string, 2)` for table rows never freed. Leaks per row. Defer to memory pass.

View File

@@ -208,17 +208,19 @@ find_git_roots :: proc(
}
search_paths :: proc(cfg: Config, allocator := context.allocator) -> [dynamic]string {
// TODO: handle error
home, _ := os.user_home_dir(context.temp_allocator)
home, err := os.user_home_dir(context.temp_allocator)
if err != nil {
panic("Failed to find home directory")
}
paths, _ := new_clone(cfg.scan_config.include, allocator)
paths := new_clone(cfg.scan_config.include, allocator)
for &include in paths {
// TODO: Do we need to manually expand ~/ in odin?
expanded, _ := strings.replace(include, "~", home, 1, allocator)
if filepath.is_abs(expanded) {
include = expanded
} else {
// TODO: show errors?
resolved, err := filepath.abs(expanded, allocator)
if err == nil {
include = resolved