Desktop file chooser integration: when the specified directory does not exist, open file chooser at home directory
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run

Fixes #10292
This commit is contained in:
Kovid Goyal 2026-07-28 09:04:57 +05:30
parent 7ed3477d5c
commit c04ce11a74
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 14 additions and 1 deletions

View file

@ -191,6 +191,8 @@ Detailed list of changes
- Linux: Fix an approx 1MB memory leak when reloading the config introduced in version 0.40.0 (:iss:`10290`)
- Desktop file chooser integration: when the specified directory does not exist, open file chooser at home directory (:iss:`10292`)
0.48.1 [2026-07-24]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -844,7 +844,18 @@ func (self *Portal) run_file_chooser(cfd ChooseFilesData) (response uint32, resu
}
}
args = append(args, "--write-pid-to", pid_path)
args = append(args, utils.IfElse(cfd.Cwd == "", "~", cfd.Cwd))
target := cfd.Cwd
if target == "" {
target = "~"
} else {
if st, err := os.Stat(cfd.Cwd); err == nil && st.IsDir() && unix.Access(cfd.Cwd, unix.R_OK|unix.X_OK) == nil {
target = cfd.Cwd
} else {
target = "~"
}
}
args = append(args, target)
cmd := exec.Command(utils.KittyExe(), args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr