aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/with_pathsep_resolve.py
blob: 37c8c598ae836599a444db8150eaa1184e7ac898 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sys
import os
import subprocess
import platform


def fix_args(args):
    just_replace_it = False
    for arg in args:
        if arg == '--fix-path-sep':
            just_replace_it = True
            continue
        if just_replace_it:
            arg = arg.replace('::', os.pathsep)
            just_replace_it = False
        yield arg

if __name__ == '__main__':
    res = list(fix_args(sys.argv[1:]))
    if platform.system() == 'Windows':
        sys.exit(subprocess.Popen(res).wait())
    else:
        os.execv(res[0], res)