fix styles path

This commit is contained in:
Vladimir Mandic
2023-05-20 10:33:31 -04:00
parent 335ad42fc8
commit e59ebe25ce
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -73,7 +73,9 @@ class StyleDatabase:
def save_styles(self, path: str) -> None:
# Write to temporary file first, so we don't nuke the file if something goes wrong
os.makedirs(os.path.dirname(path), exist_ok=True)
basedir = os.path.dirname(path)
if basedir is not None and len(basedir) > 0:
os.makedirs(basedir, exist_ok=True)
fd, temp_path = tempfile.mkstemp(".csv")
with os.fdopen(fd, "w", encoding="utf-8-sig", newline='') as file:
# _fields is actually part of the public API: typing.NamedTuple is a replacement for collections.NamedTuple,