with_pathsep_resolve.py 542 B

123456789101112131415161718192021222324
  1. import sys
  2. import os
  3. import subprocess
  4. import platform
  5. def fix_args(args):
  6. just_replace_it = False
  7. for arg in args:
  8. if arg == '--fix-path-sep':
  9. just_replace_it = True
  10. continue
  11. if just_replace_it:
  12. arg = arg.replace('::', os.pathsep)
  13. just_replace_it = False
  14. yield arg
  15. if __name__ == '__main__':
  16. res = list(fix_args(sys.argv[1:]))
  17. if platform.system() == 'Windows':
  18. sys.exit(subprocess.Popen(res).wait())
  19. else:
  20. os.execv(res[0], res)