projects
/
tabakrolletjie.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cff2127
)
Add simple save method
author
Neil
<neil@dip.sun.ac.za>
Sat, 10 Sep 2016 20:52:01 +0000
(22:52 +0200)
committer
Neil
<neil@dip.sun.ac.za>
Sat, 10 Sep 2016 20:56:24 +0000
(22:56 +0200)
tabakrolletjie/utils.py
patch
|
blob
|
history
diff --git
a/tabakrolletjie/utils.py
b/tabakrolletjie/utils.py
index 6f9e133cb999cd57b20dd64f65f251f4516415e3..19364c2b013c46279e94d6eed8b3282002e8a45d 100644
(file)
--- a/
tabakrolletjie/utils.py
+++ b/
tabakrolletjie/utils.py
@@
-6,6
+6,7
@@
import pygame.surface
import pygame.locals as pgl
import os
import sys
import pygame.locals as pgl
import os
import sys
+import json
from .constants import DEBUG
from .loader import loader
from .constants import DEBUG
from .loader import loader
@@
-92,3
+93,12
@@
def get_save_file_name():
def save_file_exists():
savefile = get_save_file_name()
return os.path.isfile(savefile)
def save_file_exists():
savefile = get_save_file_name()
return os.path.isfile(savefile)
+
+
+def write_save_file(json_data):
+ save_dir = save_location()
+ if not os.path.exists(save_dir):
+ os.makedirs(save_dir)
+ savefile = get_save_file_name()
+ with open(savefile, 'wb') as f:
+ json.dump(json_data, f, indent=3)