diff options
| author | Lex Neva <github.com@lexneva.name> | 2019-04-30 19:57:31 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2019-04-30 19:57:31 -0400 |
| commit | 43a385ea0aaa591b62fdfda629d4299e4cadc15c (patch) | |
| tree | 448a4c323fa6af4658de50eb34f4b7ddb3281062 /lib/inx/utils.py | |
| parent | b307b8e8247678a4bf128ded80a9bfd7b9b54c81 (diff) | |
| parent | 5b6923fe9d8d5f3afb0ef298ad34708e735fc5e5 (diff) | |
Merge branch 'master' into lexelby/lettering-features
Diffstat (limited to 'lib/inx/utils.py')
| -rw-r--r-- | lib/inx/utils.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/inx/utils.py b/lib/inx/utils.py index a22b1892..1dc96829 100644 --- a/lib/inx/utils.py +++ b/lib/inx/utils.py @@ -1,3 +1,4 @@ +import errno import os import gettext from os.path import dirname @@ -28,8 +29,16 @@ def build_environment(): def write_inx_file(name, contents): - inx_file_name = "inkstitch_%s_%s.inx" % (name, current_locale) - with open(os.path.join(inx_path, inx_file_name), 'w') as inx_file: + inx_locale_dir = os.path.join(inx_path, current_locale) + + try: + os.makedirs(inx_locale_dir) + except OSError as e: + if e.errno != errno.EEXIST: + raise + + inx_file_name = "inkstitch_%s.inx" % name + with open(os.path.join(inx_locale_dir, inx_file_name), 'w') as inx_file: print >> inx_file, contents.encode("utf-8") |
