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:
devangpratap 2026-10-30 22:34:06 -04:00
parent 9575920aab
commit cab970b015

View file

@ -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(