diff options
Diffstat (limited to 'fg21sim')
-rw-r--r-- | fg21sim/utils/io.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fg21sim/utils/io.py b/fg21sim/utils/io.py index c19ef47..1d30b23 100644 --- a/fg21sim/utils/io.py +++ b/fg21sim/utils/io.py @@ -19,9 +19,11 @@ logger = logging.getLogger(__name__) def _create_dir(filepath): """ Check the existence of the target directory, and create it if necessary. + """ dirname = os.path.dirname(filepath) - if not os.path.exists(dirname): + # ``dirname == ""`` if ``filepath`` does not contain directory path + if dirname and not os.path.exists(dirname): os.makedirs(dirname) logger.info("Created output directory: {0}".format(dirname)) |