From 6446295ecf81afd26794c9a51afa18056d2d4a26 Mon Sep 17 00:00:00 2001
From: dbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Mon, 7 Jun 2010 05:15:52 +0000
Subject: [PATCH] In Dojo i18n script: create output directories if they don't
 exist

git-svn-id: svn://svn.open-ils.org/ILS/trunk@16605 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 build/i18n/scripts/dojo_resource.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/build/i18n/scripts/dojo_resource.py b/build/i18n/scripts/dojo_resource.py
index 902498e2e2..83fd013797 100755
--- a/build/i18n/scripts/dojo_resource.py
+++ b/build/i18n/scripts/dojo_resource.py
@@ -35,6 +35,7 @@ import re
 import sys
 import simplejson
 import os.path
+import os
 
 class DojoResource (basel10n.BaseL10N):
     """
@@ -58,6 +59,7 @@ class DojoResource (basel10n.BaseL10N):
         # Avoid generating duplicate entries by keeping track of msgids
         msgids = dict()
 
+	#print("Reading Dojo resource file %s" % (source))
         bundle = simplejson.load(codecs.open(source, encoding='utf-8', mode='r'))
 
         for key, value in bundle.iteritems():
@@ -110,6 +112,8 @@ def main():
     if options.pot:
         pot.get_strings(options.pot)
         if options.outfile:
+            if not os.path.exists(options.outfile):
+                os.makedirs(os.path.dirname(options.outfile))
             pot.savepot(options.outfile)
         else:
             sys.stdout.write(pot.pot.__str__())
@@ -119,6 +123,8 @@ def main():
         pot.loadpo(options.create)
         pot.create_bundle()
         if options.outfile:
+            if not os.path.exists(options.outfile):
+                os.makedirs(os.path.dirname(options.outfile))
             outfile = codecs.open(options.outfile, encoding='utf-8', mode='w')
             simplejson.dump(pot.msgs, outfile, indent=4)
         else:
-- 
2.11.0