18 lines
479 B
Python
18 lines
479 B
Python
# Copyright (c) PARRRATE T&V 2021. All rights reserved.
|
|
|
|
import os
|
|
from io import StringIO
|
|
|
|
__all__ = ('readfile',)
|
|
|
|
|
|
def readfile(path: str) -> str:
|
|
srcio = StringIO()
|
|
with open(path + '.bu4', encoding='utf-8') as file:
|
|
for line in file:
|
|
if line.startswith('@'):
|
|
srcio.write(readfile(os.path.join(path, os.path.pardir, line.removeprefix('@').strip())))
|
|
else:
|
|
srcio.write(line)
|
|
return srcio.getvalue()
|