From b236bac0358af8c9883c9b16c11296945b49af5d Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Thu, 16 Apr 2026 21:56:47 -0400 Subject: [PATCH] Skip speechd config files that don't exist. --- usr/local/bin/speechd_rate.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/usr/local/bin/speechd_rate.py b/usr/local/bin/speechd_rate.py index bf236ab..fb36b3a 100755 --- a/usr/local/bin/speechd_rate.py +++ b/usr/local/bin/speechd_rate.py @@ -44,6 +44,11 @@ def update_speechd_config_content(content, rate, volume, pitch): return newContent +def get_writable_config_targets(configTargets): + """Return existing config paths to update, preserving order.""" + return [configPath for configPath in configTargets if os.path.exists(configPath)] + + class SpeechRateMenu: def __init__(self, title="Speech Configuration"): self.title = title @@ -122,7 +127,7 @@ class SpeechRateMenu: def save_settings_to_config(self): """Save the current settings to the speech-dispatcher config file""" try: - for configPath in self.configTargets: + for configPath in get_writable_config_targets(self.configTargets): with open(configPath, 'r') as f: content = f.read()