import time
import pygame.surface
import pygame.locals as pgl
+import os
+import sys
from .constants import DEBUG
from .loader import loader
base.blit(background, (offset, offset), None)
base.blit(foreground, (0, 0), None)
return base
+
+
+def save_location():
+ """Return the directory for the save location."""
+ app = "tabakrolletjie"
+ if sys.platform.startswith('win'):
+ if 'APPDATA' in os.environ:
+ return os.path.join(os.environ['APPDATA'], app)
+ return os.path.join(os.path.expanduser('~'), '.' + app)
+ elif 'XDG_DATA_HOME' in os.environ:
+ return os.path.join(os.environ['XDG_DATA_HOME'], app)
+ return os.path.join(os.path.expanduser('~'), '.local', 'share', app)
+
+
+def get_save_file_name():
+ return os.path.join(save_location(), 'savegame.json')
+
+
+def save_file_exists():
+ savefile = get_save_file_name()
+ return os.path.isfile(savefile)