summaryrefslogtreecommitdiff
path: root/src/sliceitoff/hiscores/hiscores.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/sliceitoff/hiscores/hiscores.py')
-rw-r--r--src/sliceitoff/hiscores/hiscores.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/sliceitoff/hiscores/hiscores.py b/src/sliceitoff/hiscores/hiscores.py
index a6c2bf0..5ce8ced 100644
--- a/src/sliceitoff/hiscores/hiscores.py
+++ b/src/sliceitoff/hiscores/hiscores.py
@@ -1,5 +1,6 @@
-""" hiscores.hiscores - high socres: loading, saving, converting to string"""
+""" hiscores.hiscores - high socres: loading, saving, converting to string """
import os
+from pathlib import Path
from .static import INITIAL_HIGHSCORES, MAX_HIGHSCORES
@@ -8,10 +9,13 @@ class HiScores:
def __init__(self):
""" On creation load high scores from config file """
self.table=[]
- self.config_filename = os.path.join(
- os.getenv('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
@@ -48,13 +52,14 @@ class HiScores:
config_file.writelines(oldlines)
for score, name in self.table:
config_file.write(f"hiscore={score}!{name}\n")
+ config_file.write("\n")
def __str__(self):
text = (
" "
"\xeeH\xecI\xedG\xe9H "
"\xeaS\xedC\xeeO\xebR\xe9E\xecS\xeb!\xed!\n\n")
- half = len(self.table)//2
+ half = len(self.table) // 2
for i in range(half):
text += (
f"\xed{self.table[i][1]:<3s} "