Merge remote-tracking branch 'origin/master'

This commit is contained in:
Igor Brylyov 2023-09-05 15:27:28 +03:00
commit e2b194298b

View file

@ -2,24 +2,36 @@
writers.writePython3Bin "test-script" { libraries = []; } '' writers.writePython3Bin "test-script" { libraries = []; } ''
import sys import sys
import os import os
import json
def my_function(): def main():
arg = sys.argv[1] arg = sys.argv[1]
number = int(arg)
if (number == 1): data = json.loads(arg)
os.makedirs('13') paths = data.get('filesMeta')
if (number == 2): path = data.get('path')
raise Exception("error") for el in paths:
if (number == 3): if (el.get('path') is None and el.get('type') == 'folder'):
print(200) if (not os.path.exists((path + el.get('name')))):
print(200) os.makedirs(path + el.get('name'))
print(200) else:
print(200) filePath = el.get('path')
print(200) type = el.get('type')
print(200) name = el.get('name')
rewrite = el.get('rewrite')
newPath = path + filePath + '/'
if (type == 'file'):
if (rewrite and not os.path.exists((newPath + name))):
file = open(newPath + name, 'w')
file.write(str(el))
file.close()
if (type == 'folder'):
if (rewrite and not os.path.exists((newPath + name))):
os.makedirs(newPath + name)
if __name__ == '__main__': main()
my_function()
'' ''