[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54367] trunk/blender/release/scripts: code cleanup: use exist_ok keyword arg to os.makedirs() rather then checking if the dir exists first.
Campbell Barton
ideasman42 at gmail.com
Thu Feb 7 05:02:26 CET 2013
Revision: 54367
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54367
Author: campbellbarton
Date: 2013-02-07 04:02:24 +0000 (Thu, 07 Feb 2013)
Log Message:
-----------
code cleanup: use exist_ok keyword arg to os.makedirs() rather then checking if the dir exists first.
Modified Paths:
--------------
trunk/blender/release/scripts/modules/bpy_extras/io_utils.py
trunk/blender/release/scripts/startup/bl_operators/wm.py
Modified: trunk/blender/release/scripts/modules/bpy_extras/io_utils.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_extras/io_utils.py 2013-02-07 02:50:35 UTC (rev 54366)
+++ trunk/blender/release/scripts/modules/bpy_extras/io_utils.py 2013-02-07 04:02:24 UTC (rev 54367)
@@ -436,10 +436,7 @@
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)
Modified: trunk/blender/release/scripts/startup/bl_operators/wm.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/wm.py 2013-02-07 02:50:35 UTC (rev 54366)
+++ trunk/blender/release/scripts/startup/bl_operators/wm.py 2013-02-07 04:02:24 UTC (rev 54367)
@@ -1740,8 +1740,7 @@
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
More information about the Bf-blender-cvs
mailing list