Kaydet (Commit) a4f8e580 authored tarafından Jack Jansen's avatar Jack Jansen

Allow selecting a template in findtemplate(), so Classic programs can build…

Allow selecting a template in findtemplate(), so Classic programs can build Carbon applets and vice-versa.
üst 881cd368
...@@ -40,19 +40,21 @@ READ = 1 ...@@ -40,19 +40,21 @@ READ = 1
WRITE = 2 WRITE = 2
def findtemplate(): def findtemplate(template=None):
"""Locate the applet template along sys.path""" """Locate the applet template along sys.path"""
if not template:
template=TEMPLATE
for p in sys.path: for p in sys.path:
template = os.path.join(p, TEMPLATE) file = os.path.join(p, template)
try: try:
template, d1, d2 = macfs.ResolveAliasFile(template) file, d1, d2 = macfs.ResolveAliasFile(file)
break break
except (macfs.error, ValueError): except (macfs.error, ValueError):
continue continue
else: else:
raise BuildError, "Template %s not found on sys.path" % `TEMPLATE` raise BuildError, "Template %s not found on sys.path" % `template`
template = template.as_pathname() file = file.as_pathname()
return template return file
def process(template, filename, output, copy_codefragment): def process(template, filename, output, copy_codefragment):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment