diff --git a/scripts/buld.py b/scripts/buld.py index 4362b3c..8586fdd 100644 --- a/scripts/buld.py +++ b/scripts/buld.py @@ -3,6 +3,7 @@ import os import re import settings +import instruments # print("all projects:") # print(settings.all_projects) diff --git a/scripts/instruments.py b/scripts/instruments.py new file mode 100644 index 0000000..4ed1ad5 --- /dev/null +++ b/scripts/instruments.py @@ -0,0 +1,18 @@ +import shutil +import os + +def CreateOrRestoreFromBackup(base_dir, relative_path_to_files): + + for rel_path in relative_path_to_files: + + abs_path = os.path.join(base_dir, rel_path) + abs_path_backup = "{0}.build_backup".format(os.path) + + if os.path.exists(abs_path_backup): + # restore from backup + shutil.copyfile(abs_path_backup, abs_path) + else: + # create backup + shutil.copyfile(abs_path, abs_path_backup) + + return None