mission_merger.py 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. #This was written for the 501st Starsim unit in Arma3
  2. #For faster mission integration with mission scripts
  3. #Written by CC Klein copyright 2018
  4. import os
  5. import subprocess
  6. from distutils.dir_util import *
  7. #Creating String values for Directory Structure
  8. dir = os.path.dirname(__file__)
  9. filename = os.path.join(dir, '../../Missions/')
  10. tmp_file = filename+"Temp/"
  11. script_files = os.path.join(dir, '../../Scripts/')
  12. mission_files = os.listdir(filename)
  13. pbo_tool_files = os.path.join(dir, '../../Util/Tools/')
  14. pbo_tool = pbo_tool_files+"MakePbo.exe"
  15. #If temp dir exists delete then continue
  16. if os.path.isdir(tmp_file) == True:
  17. remove_tree(tmp_file)
  18. #For each mission folder in mission_files copy them to
  19. #tmp dir then copy scripts into mission tmp dir
  20. for name in mission_files:
  21. if name.endswith('.txt') == False and name != 'Temp' and name.endswith('.pbo') == False:
  22. print(name)
  23. src_dir = filename+name
  24. tmp_dir = tmp_file+name
  25. mkpath(tmp_dir)
  26. copy_tree(src_dir, tmp_dir)
  27. copy_tree(script_files, tmp_dir)
  28. subprocess.call([pbo_tool, "-P",tmp_dir])