def copy_xul_runtime(dir1, dir2):
    """ Copy the firefox/xulrunner runtime to a new folder, in which
    we rename the firefox exe to xulrunner. This thus creates a xul
    runtime in a location where we have write access. Used to be able
    to set the process name on Windows, and maybe used to distribute
    apps *with* the runtime.
    """
    t0 = time.time()
    # Get extension
    ext = '.exe' if sys.platform.startswith('win') else ''
    # On Rasberry Pi, the xul runtime is in a (linked) subdir
    if op.isdir(op.join(dir1, 'xulrunner')):
        dir1 = op.join(dir1, 'xulrunner')
    # Clear
    if op.isdir(dir2):
        shutil.rmtree(dir2)
    os.mkdir(dir2)
    try:
        # Copy all files except dirs
        for fname in os.listdir(dir1):
            filename1 = op.join(dir1, fname)
            filename2 = op.join(dir2, fname)
            if op.isfile(filename1):
                shutil.copy2(filename1, filename2)
        # Copy firefox exe -> xulrunner
        for exe_name in ('firefox', 'iceweasel', 'xulrunner', 'firefox'):
            exe = op.join(dir1, exe_name + ext)
            if op.isfile(exe):
                break
        shutil.copy2(exe, op.join(dir2, 'xulrunner' + ext))
        logging.info('Copied firefox (in %1.2f s)' + (time.time()-t0))
    except Exception:
        # Clean up
        shutil.rmtree(dir2)
        raise
dataset/ETHPy150Open zoofIO/flexx/flexx/webruntime/xul.py/copy_xul_runtime/operator `%` -> `+`