From 94b83cbef99f6742b2167f67bbf438dd40348f4f Mon Sep 17 00:00:00 2001 From: Mikey Sklar Date: Sat, 8 Mar 2025 17:28:45 -0800 Subject: [PATCH] adafruit-pitft.py boot_dir fix for /boot/firmware vs /boot logic for the config.txt location --- adafruit-pitft.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/adafruit-pitft.py b/adafruit-pitft.py index cfa43c2..1dff360 100644 --- a/adafruit-pitft.py +++ b/adafruit-pitft.py @@ -743,8 +743,14 @@ user_homedir = os.path.expanduser(f"~{username}") if shell.isdir(user_homedir): target_homedir = user_homedir -boot_dir = shell.get_boot_config() -if boot_dir is None: +boot_dir = "/boot/firmware" if shell.isdir("/boot/firmware") else "/boot" + +# If neither directory is valid, use shell.get_boot_config() +if not shell.isdir(boot_dir): + boot_dir = shell.get_boot_config() + +# Final safeguard: Ensure boot_dir is actually a directory and not a file path +if boot_dir is None or not shell.isdir(boot_dir): shell.bail("Unable to find boot directory") if shell.get_raspbian_version() == "bullseye":