diff options
author | James Ennis <james.ennis@codethink.com> | 2018-05-04 16:08:30 +0100 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2018-05-07 10:25:52 +0000 |
commit | 53bff7d6610cbb64c75155817cb64d3392513c87 (patch) | |
tree | 26ea112b417867f7c8b8e000d32b1c2542ee24bd | |
parent | 745d0647729dd31f07acc5829fd3364615673bc5 (diff) | |
download | buildstream-53bff7d6610cbb64c75155817cb64d3392513c87.tar.gz |
app.py: Ensure an elements sub-dir is created upon project initialisation
-rw-r--r-- | buildstream/_frontend/app.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/buildstream/_frontend/app.py b/buildstream/_frontend/app.py index c32f8c90b..3bcb0d962 100644 --- a/buildstream/_frontend/app.py +++ b/buildstream/_frontend/app.py @@ -343,6 +343,7 @@ class App(): directory = self._main_options['directory'] directory = os.path.abspath(directory) project_path = os.path.join(directory, 'project.conf') + elements_path = os.path.join(directory, 'elements') try: # Abort if the project.conf already exists, unless `--force` was specified in `bst init` @@ -371,6 +372,13 @@ class App(): except IOError as e: raise AppError("Error creating project directory {}: {}".format(directory, e)) from e + # Create the elements sub-directory if it doesnt exist + try: + os.makedirs(elements_path, exist_ok=True) + except IOError as e: + raise AppError("Error creating elements sub-directory {}: {}" + .format(elements_path, e)) from e + # Dont use ruamel.yaml here, because it doesnt let # us programatically insert comments or whitespace at # the toplevel. |