diff options
| author | Lex Neva <github.com@lexneva.name> | 2019-04-20 21:46:28 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2019-04-20 21:46:28 -0400 |
| commit | d61b99891285ff879cbacdb8e23f9c025efc6a09 (patch) | |
| tree | 748f0ff73ce0b1a5459f8e2c4f963e87ffe8090e /lib/inx/utils.py | |
| parent | 09c46e0fb499987899a2e67819099eba2c121487 (diff) | |
| parent | e717fa140d4d2b46bb4884999b945c9a875ef59d (diff) | |
Merge remote-tracking branch 'origin/master' into lexelby/electron
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") |
