File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,25 @@ def __init__(self, filename: str):
7272
7373 super ().__init__ (ab_dir .user_data_dir , filename )
7474
75+ if not self .healthy ():
76+ log .warn ("Settings health check failed, resetting" )
77+ self .restore_default_settings ()
78+
79+ def healthy (self ) -> bool :
80+ """
81+ Checks the settings file to see if it is healthy. Returns True if all checks pass, otherwise returns False.
82+ """
83+ healthy = True
84+
85+ # check for write access to the current bw dir
86+ healthy = healthy and os .access (self .settings .get ("current_bw_dir" ), os .W_OK )
87+
88+ # check for write access to the custom bw dirs
89+ access = [os .access (path , os .W_OK ) for path in self .settings .get ("custom_bw_dirs" )]
90+ healthy = healthy and False not in access
91+
92+ return healthy
93+
7594 @staticmethod
7695 def update_old_settings (directory : str , filename : str ) -> None :
7796 """Recycling code to enable backward compatibility: This function is only required for compatibility
You can’t perform that action at this time.
0 commit comments