-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprebake.py
36 lines (24 loc) · 880 Bytes
/
prebake.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os
import sys
import shutil
# games/BAR.sdd/.git/FETCH_HEAD
script_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(script_dir)
import unitbake
def report_progress(progress, text=None):
pass
progress_func = report_progress
def set_progress_cb(cb):
global progress_func
progress_func = cb
def prebake():
dirs = unitbake.get_dirs(script_dir)
progress_func(0.1, "Create {}".format(dirs.work_dir))
os.makedirs(dirs.work_dir, exist_ok=True)
progress_func(0.33, "Copy {} to {}".format(dirs.game_units, dirs.backup_units))
shutil.copytree(dirs.game_units, dirs.backup_units, dirs_exist_ok=True)
progress_func(0.66, "Copy {} to {}".format(dirs.orig_baked, dirs.backup_baked))
shutil.copytree(dirs.orig_baked, dirs.backup_baked, dirs_exist_ok=True)
progress_func(1.0)
if __name__ == '__main__':
prebake()