Index: tools/json_schema_compiler/schema_loader.py |
diff --git a/tools/json_schema_compiler/schema_loader.py b/tools/json_schema_compiler/schema_loader.py |
index 9fea1ab8250229a47172e7a18dabd26968ee6166..881074300bd0b296f8a712b39b3a6b18cc6409f7 100644 |
--- a/tools/json_schema_compiler/schema_loader.py |
+++ b/tools/json_schema_compiler/schema_loader.py |
@@ -3,6 +3,7 @@ |
# found in the LICENSE file. |
import os |
+import re |
import sys |
import idl_schema |
@@ -30,8 +31,14 @@ class SchemaLoader(object): |
return default_namespace |
namespace_name, type_name = name_parts |
real_name = None |
+ # Try to find the file defining the namespace. Eg. for |
+ # nameSpace.sub_name_space.Type' the following heuristics looks for: |
+ # 1. name_space_sub_name_space.json, |
+ # 2. name_space_sub_name_space.idl. |
for ext in ['json', 'idl']: |
- filename = '%s.%s' % (namespace_name, ext) |
+ basename = re.sub('(?!^)([A-Z]+)', r'_\1', |
+ namespace_name.replace('.', '_')).lower() |
not at google - send to devlin
2014/03/28 18:42:25
there is already a helper for this sort of thing i
mtomasz
2014/03/31 01:39:20
Done.
|
+ filename = '%s.%s' % (basename, ext) |
filepath = os.path.join(self._real_path, filename); |
if os.path.exists(filepath): |
real_name = filename |