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
|
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:
|
class SpeechRateMenu:
|
||||||
def __init__(self, title="Speech Configuration"):
|
def __init__(self, title="Speech Configuration"):
|
||||||
self.title = title
|
self.title = title
|
||||||
@@ -122,7 +127,7 @@ class SpeechRateMenu:
|
|||||||
def save_settings_to_config(self):
|
def save_settings_to_config(self):
|
||||||
"""Save the current settings to the speech-dispatcher config file"""
|
"""Save the current settings to the speech-dispatcher config file"""
|
||||||
try:
|
try:
|
||||||
for configPath in self.configTargets:
|
for configPath in get_writable_config_targets(self.configTargets):
|
||||||
with open(configPath, 'r') as f:
|
with open(configPath, 'r') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user