summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2021-10-16 23:53:20 -0500
committerDudemanguy <random342@airmail.cc>2021-11-14 19:13:10 +0000
commitf7fab994eb31bb83b7f1be9eebfaaec09f7da5ae (patch)
tree13a45e0a8d2b3fc8a09c9e93ece56cf12e3fbc3a /TOOLS
parentc698575c5760d06b69cce4e92aed124a031f5a6c (diff)
downloadmpv-f7fab994eb31bb83b7f1be9eebfaaec09f7da5ae.tar.bz2
mpv-f7fab994eb31bb83b7f1be9eebfaaec09f7da5ae.tar.xz
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.
Diffstat (limited to 'TOOLS')
-rwxr-xr-xTOOLS/file2string.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/TOOLS/file2string.py b/TOOLS/file2string.py
index b641a1df2f..1f2cd64fdf 100755
--- a/TOOLS/file2string.py
+++ b/TOOLS/file2string.py
@@ -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)