summaryrefslogtreecommitdiff
path: root/morphlib/app.py
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/app.py')
-rw-r--r--morphlib/app.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index 9ae177f5..fcf54118 100644
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -223,18 +223,14 @@ class Morph(cliapp.Application):
self.settings.dump_config(sys.stdout)
sys.exit(0)
- def create_dir_if_not_exists(dir):
- if not os.path.exists(dir):
- os.makedirs(dir)
-
tmpdir = self.settings['tempdir']
- create_dir_if_not_exists(tmpdir)
- create_dir_if_not_exists(os.path.join(tmpdir, 'chunks'))
- create_dir_if_not_exists(os.path.join(tmpdir, 'staging'))
- create_dir_if_not_exists(os.path.join(tmpdir, 'failed'))
- create_dir_if_not_exists(os.path.join(tmpdir, 'deployments'))
-
- create_dir_if_not_exists(self.settings['cachedir'])
+ for required_dir in (os.path.join(tmpdir, 'chunks'),
+ os.path.join(tmpdir, 'staging'),
+ os.path.join(tmpdir, 'failed'),
+ os.path.join(tmpdir, 'deployments'),
+ self.settings['cachedir']):
+ if not os.path.exists(required_dir):
+ os.makedirs(required_dir)
cliapp.Application.process_args(self, args)