Don't LBYL when creating missing data directories
[mudpy.git] / mudpy / data.py
index 25b423b..b73959a 100644 (file)
@@ -111,10 +111,9 @@ class Data:
            ):
 
             # make parent directories if necessary
-            if not os.path.exists(os.path.dirname(self.source)):
-                old_umask = os.umask(normal_umask)
-                os.makedirs(os.path.dirname(self.source))
-                os.umask(old_umask)
+            old_umask = os.umask(normal_umask)
+            os.makedirs(os.path.dirname(self.source), exist_ok=True)
+            os.umask(old_umask)
 
             # backup the file
             if "mudpy.limit" in self.universe.contents: