From 38952e490dbe40cb4e9208cbc0b1e8cb33e55638 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 28 Jul 2026 03:01:06 +0000 Subject: [PATCH] fix: robustly handle non-existent initial directory in choose-files kitten --- kittens/choose_files/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kittens/choose_files/main.go b/kittens/choose_files/main.go index ceea4b66c..91c490b6f 100644 --- a/kittens/choose_files/main.go +++ b/kittens/choose_files/main.go @@ -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) {