Skip to content

Commit de1ad60

Browse files
authored
Update config_manager.py
1 parent d0723b0 commit de1ad60

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

config_manager.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# config_manager.py
21
import os
32
import json
43
import logging
5-
from jsonschema import validate, ValidationError # Assuming jsonschema is available or install if needed, but per tools, no install, so skip or use simple validation
64

75
class ConfigManager:
86
base_dir = os.path.join(os.path.expanduser('~'), '.hackeros', 'Hacker-Launcher')
@@ -19,13 +17,13 @@ def __init__(self):
1917
os.makedirs(self.protons_dir, exist_ok=True)
2018
os.makedirs(self.logs_dir, exist_ok=True)
2119
self.setup_logging()
22-
self.load_settings()
20+
self.settings = self.load_settings() # Store settings in instance variable
2321

2422
def setup_logging(self):
2523
logging.basicConfig(
2624
filename=os.path.join(self.logs_dir, 'launcher.log'),
27-
level=logging.INFO,
28-
format='%(asctime)s - %(levelname)s - %(message)s'
25+
level=logging.DEBUG, # Changed to DEBUG for more details
26+
format='%(asctime)s [%(levelname)s] %(message)s'
2927
)
3028

3129
def load_games(self):
@@ -40,6 +38,7 @@ def load_games(self):
4038
return games
4139
except (json.JSONDecodeError, IOError, ValueError) as e:
4240
logging.error(f"Error loading games.json: {e}")
41+
print(f"Error loading games.json: {e}") # Add console output
4342
return []
4443
return []
4544

@@ -66,10 +65,9 @@ def load_settings(self):
6665
default_settings.update(settings)
6766
except (json.JSONDecodeError, IOError, ValueError) as e:
6867
logging.error(f"Error loading settings.json: {e}")
69-
# Only save if changed, but for simplicity, save once at load if needed
68+
print(f"Error loading settings.json: {e}") # Add console output
7069
return default_settings
7170

7271
def save_settings(self, settings):
7372
with open(self.settings_file, 'w') as f:
7473
json.dump(settings, f, indent=4)
75-

0 commit comments

Comments
 (0)