mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-11-20 07:02:28 +00:00
desktop-ui: Use the kitten path fallback when os.Executable fails
enable_portal checked eerr instead of err after filepath.Abs, so a failing os.Executable always aborted with a nil error and the Which fallback was never used, while an Abs error was ignored. Check err, and report the os.Executable error if kitten is not in PATH either.
This commit is contained in:
parent
9575920aab
commit
cab970b015
1 changed files with 4 additions and 2 deletions
|
|
@ -434,9 +434,11 @@ Interfaces=%s;
|
|||
dbus_service_defn := filepath.Join(dbus_service_dir, PORTAL_BUS_NAME+".service")
|
||||
exe_path, eerr := os.Executable()
|
||||
if eerr != nil {
|
||||
exe_path = utils.Which("kitten")
|
||||
if exe_path = utils.Which("kitten"); exe_path == "" {
|
||||
return fmt.Errorf("failed to get path to kitten executable with error: %w", eerr)
|
||||
}
|
||||
}
|
||||
if exe_path, err = filepath.Abs(exe_path); eerr != nil {
|
||||
if exe_path, err = filepath.Abs(exe_path); err != nil {
|
||||
return fmt.Errorf("failed to get path to kitten executable with error: %w", err)
|
||||
}
|
||||
if err = os.WriteFile(dbus_service_defn, utils.UnsafeStringToBytes(fmt.Sprintf(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue