From 4b8fe80e6e5c62247f38dbfcf93c46246e719652 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 7 Feb 2013 04:02:24 +0000 Subject: code cleanup: use exist_ok keyword arg to os.makedirs() rather then checking if the dir exists first. --- release/scripts/modules/bpy_extras/io_utils.py | 5 +---- release/scripts/startup/bl_operators/wm.py | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py index 21bad5ec1e4..dfb6c46ef87 100644 --- a/release/scripts/modules/bpy_extras/io_utils.py +++ b/release/scripts/modules/bpy_extras/io_utils.py @@ -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) diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 902cfdd418b..6ac61a9f5e7 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -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 -- cgit v1.2.3