def _update_gn_executable_output_directory(commands):
    """Update the output path of executables and response files.

    The GN and ZN builds place their executables in different locations
    so adjust then GN ones to match the ZN ones.

    Args:
      commands: list of command strings from the GN build.
    Returns:
      A new list of command strings.
    """
    replacements = {
        'TOOLCHAIN/main_with_static':
            'TOOLCHAIN/obj/public/canaries/main_with_static',
        'TOOLCHAIN/main_with_shared':
            'TOOLCHAIN/obj/public/canaries/main_with_shared',
        'TOOLCHAIN_SHARED/libfoo_shared':
            'TOOLCHAIN_SHARED/obj/public/canaries/libfoo_shared',
    }

    result = []
    for cmd in commands:
        for key, val in replacements.items():
            cmd = cmd.replace(key, val)
        result.append(cmd)

    return result