fix: robustly handle non-existent initial directory in choose-files kitten

This commit is contained in:
copilot-swe-agent[bot] 2026-07-28 03:01:06 +00:00 committed by GitHub
parent 7b3cbc1de3
commit 38952e490d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -983,7 +983,11 @@ func main(_ *cli.Command, opts *Options, args []string) (rc int, err error) {
return
}
if st, serr := os.Stat(default_cwd); serr != nil || !st.IsDir() {
default_cwd = utils.Expanduser("~")
if home := utils.Expanduser("~"); home != "~" {
default_cwd = home
} else {
default_cwd = "/"
}
}
lp.OnInitialize = func() (string, error) {