"""Miscellaneous functions for the mudpy engine."""
-# Copyright (c) 2004-2018 Jeremy Stanley <fungi@yuggoth.org>. Permission
-# to use, copy, modify, and distribute this software is granted under
-# terms provided in the LICENSE file distributed with this software.
+# Copyright (c) 2004-2018 mudpy authors. Permission to use, copy,
+# modify, and distribute this software is granted under terms
+# provided in the LICENSE file distributed with this software.
import codecs
import os
if file_name:
if not os.path.isabs(file_name):
file_name = os.path.join(universe.startdir, file_name)
+ os.makedirs(os.path.dirname(file_name), exist_ok=True)
file_descriptor = codecs.open(file_name, "a", "utf-8")
for line in lines:
file_descriptor.write(timestamp + " " + line + "\n")
if file_name:
if not os.path.isabs(file_name):
file_name = os.path.join(universe.startdir, file_name)
+ os.makedirs(os.path.dirname(file_name), exist_ok=True)
file_descriptor = codecs.open(file_name, "w", "utf-8")
file_descriptor.write(pid + "\n")
file_descriptor.flush()