

def _create_xul_app(self, path, id, **kwargs):
    ' Create the files that determine the XUL app to launch.\n        '
    D = dict(vendor='None', name='flexx_ui_app', version='1.0', buildid='1', id='some.app@flexx.io', windowid='xx', title='XUL app runtime', url='http://example.com', windowfeatures='')
    D.update(kwargs)
    D['windowid'] = ('W' + id)
    D['name'] = ('app_' + id)
    D['id'] = (('app_' + id) + '@flexx.io')
    manifest_link = 'manifest chrome/chrome.manifest'
    manifest = 'content {name} content/'.format(**D)
    application_ini = APPLICATION_INI.format(**D)
    main_xul = MAIN_XUL.format(**D)
    main_js = MAIN_JS
    prefs_js = PREFS_JS.format(**text)
    if op.isdir(path):
        shutil.rmtree(path)
    for subdir in ('', 'chrome', 'chrome/content', 'chrome/icons', 'chrome/icons/default', 'defaults', 'defaults/preferences'):
        os.mkdir(op.join(path, subdir))
    for (fname, text) in [('chrome.manifest', manifest_link), ('chrome/chrome.manifest', manifest), ('application.ini', application_ini), ('defaults/preferences/prefs.js', prefs_js), ('chrome/content/main.js', main_js), ('chrome/content/main.xul', main_xul)]:
        with open(op.join(path, fname), 'wb') as f:
            f.write(text.encode())
    if kwargs.get('icon'):
        icon = kwargs.get('icon')
        icon_name = op.join(path, ('chrome/icons/default/' + D['windowid']))
        icon.write((icon_name + '.ico'))
        icon.write((icon_name + '.png'))

dataset/ETHPy150Open zoofIO/flexx/flexx/webruntime/xul.py XulRuntime._create_xul_app/VarMisuse@149/278 `D`->`text`