diff options
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 |