diff options
author | Viljami Ilola <+@hix.fi> | 2024-04-10 18:04:27 +0300 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-04-10 18:04:27 +0300 |
commit | 6f2eeab32b08c75399c971a52238bdcdc16085b2 (patch) | |
tree | 6972e845a3351023d56e8e7e4882262722041b9b /src/sliceitoff/hiscores/hiscores.py | |
parent | 7b312aab1af3b2c67bc29df1faf46e39947b51fe (diff) |
tests for highscores
Diffstat (limited to 'src/sliceitoff/hiscores/hiscores.py')
-rw-r--r-- | src/sliceitoff/hiscores/hiscores.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/sliceitoff/hiscores/hiscores.py b/src/sliceitoff/hiscores/hiscores.py index 372db31..627c3f7 100644 --- a/src/sliceitoff/hiscores/hiscores.py +++ b/src/sliceitoff/hiscores/hiscores.py @@ -6,16 +6,21 @@ from .static import INITIAL_HIGHSCORES, MAX_HIGHSCORES class HiScores: """ Keeps track of high scores """ - def __init__(self): + def __init__(self, filename = None): """ On creation load high scores from config file """ self.table=[] - if os.name == 'nt': - self.config_filename = os.path.join(Path.home(), "sliceitoff.cfg") + if filename: + self.config_filename = filename else: - self.config_filename = os.path.join( - Path.home(), - ".config", - "sliceitoffrc") + if os.name == 'nt': + self.config_filename = os.path.join( + Path.home(), + "sliceitoff.cfg") + else: + self.config_filename = os.path.join( + Path.home(), + ".config", + "sliceitoffrc") if not os.path.isfile(self.config_filename): self.table=INITIAL_HIGHSCORES[:] return |