def add_file_from_str(self, name, content, executable=False, convert_nl=False, dedent=False):
path = os.path.join(self.cdrom_dir, name)
if dedent:
content = textwrap.dedent(content)
if convert_nl:
content = content.replace("\n", "\r\n")
with open(path, "w") as f:
f.write(content)
if executable:
current = os.stat(path)
os.chmod(path, current.st_mode | stat.S_IEXEC)
评论列表
文章目录