code cleanup: use exist_ok keyword arg to os.makedirs() rather then checking if the...
authorCampbell Barton <ideasman42@gmail.com>
Thu, 7 Feb 2013 04:02:24 +0000 (04:02 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 7 Feb 2013 04:02:24 +0000 (04:02 +0000)
release/scripts/modules/bpy_extras/io_utils.py
release/scripts/startup/bl_operators/wm.py

index 21bad5e..dfb6c46 100644 (file)
@@ -436,10 +436,7 @@ def path_reference_copy(copy_set, report=print):
             pass
         else:
             dir_to = os.path.dirname(file_dst)
-
-            if not os.path.isdir(dir_to):
-                os.makedirs(dir_to)
-
+            os.makedirs(dir_to, exist_ok=True)
             shutil.copy(file_src, file_dst)
 
 
index 902cfdd..6ac61a9 100644 (file)
@@ -1740,8 +1740,7 @@ class WM_OT_addon_install(Operator):
             return {'CANCELLED'}
 
         # create dir is if missing.
-        if not os.path.exists(path_addons):
-            os.makedirs(path_addons)
+        os.makedirs(path_addons, exist_ok=True)
 
         # Check if we are installing from a target path,
         # doing so causes 2+ addons of same name or when the same from/to