techage_modpack/signs_bot/del_eol_blanks.py
2023-08-26 10:27:15 +02:00

27 lines
722 B
Python
Executable File

#!/usr/bin/env python
import os
spath = "./"
n = len(spath)
for root, dirs, files in os.walk(spath):
offs = root[n:]
for fname in files:
name, ext = os.path.splitext(fname)
if ext == ".lua":
src = os.path.join(spath, offs, fname)
lOut = []
changed = False
for line in open(src, "rt").readlines():
line2 = line.rstrip()
if len(line2) != len(line) - 1:
changed = True
lOut.append(line2)
if changed:
print("%s changed" % src)
text = "\n".join(lOut) + "\n"
open(src, "wt").write(text)