Создал файл с вспомогательными функциями
This commit is contained in:
parent
c5090aa183
commit
0594fa2644
|
|
@ -3,6 +3,7 @@ import os
|
|||
import re
|
||||
|
||||
import settings
|
||||
import instruments
|
||||
|
||||
# print("all projects:")
|
||||
# print(settings.all_projects)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
Loading…
Reference in New Issue