mirror of https://github.com/mpv-player/mpv
TOOLS/file2string.py: support outputting to file
Another modification for the upcoming meson build. Meson can capture the stdout and redirect it to a file. However, this is considered a hack. It's better to just add a few lines to this script and write a file directly.
This commit is contained in:
parent
c698575c57
commit
f7fab994eb
|
@ -39,5 +39,10 @@ def file2string(infilename, infile, outfile):
|
|||
outfile.write('"' + ''.join(conv[c] for c in line) + '"\n')
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
outfile = sys.stdout
|
||||
else:
|
||||
outfile = open(sys.argv[2], "w")
|
||||
|
||||
with open(sys.argv[1], 'rb') as infile:
|
||||
file2string(sys.argv[1], infile, sys.stdout)
|
||||
file2string(sys.argv[1], infile, outfile)
|
||||
|
|
Loading…
Reference in New Issue