oxygine_helper.py 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import os
  2. import sys
  3. import platform
  4. class helper(object):
  5. def __init__(self, root, version=0):
  6. self.path_root = root + "/"
  7. self.path_process_xml = self.path_root + "tools/oxyresbuild.py"
  8. self.path_bmfont = self.path_root + "/3rdPartyTools/BMFont/bmfont.com"
  9. bit64 = ""
  10. if platform.machine().endswith('64'):
  11. bit64 = "_64"
  12. if sys.platform == "darwin":
  13. self.path_pvrtextool = self.path_root + "/3rdPartyTools/macosx/PVRTexToolCLI "
  14. elif sys.platform == "linux2":
  15. self.path_pvrtextool = self.path_root + "/3rdPartyTools/linux/PVRTexToolCLI{} ".format(bit64, )
  16. else:
  17. self.path_pvrtextool = self.path_root + "/3rdPartyTools/PVRTexToolCLI{}.exe ".format(bit64, )
  18. def process_xml(self, embedded, args):
  19. if embedded:
  20. folder = self.path_root + "tools"
  21. if folder not in sys.path:
  22. sys.path.append(folder)
  23. import oxyresbuild
  24. return oxyresbuild.process(args)
  25. else:
  26. os.system("python \"{}\" {}".format(self.path_process_xml, args))