INNER CODE UNIT · Python
write_file
Cooler2/ApusGameEngine · tools/normalize_indent.py:297
def write_file(path, bom, crlf, lines):
sep = '\r\n' if crlf else '\n'
text = sep.join(lines)
raw = (b'\xef\xbb\xbf' if bom else b'') + text.encode('utf-8')
with open(path, 'wb') as f:
f.write(raw)
# ---------------------------------------------------------------------------
# Collect files
# ---------------------------------------------------------------------------
def collect_files(root, include_extra, include_tmp):
result = []
for dirpath, dirs, files in os.walk(root):
# Prune unwanted dirs in-place
skip = set(SKIP_DIRS)
if not include_extra: