Skip speechd config files that don't exist.
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user