def _file_exists(ctx, path):
    """
    Checks if a file exists in the file system

    Args:
        ctx: bazel repo rule context
        path: path to the target

    Returns:
        True if file exists in the given path
    """
    if not ctx.os.name.startswith("windows"):
        return ctx.execute(["test", "-f", path]).return_code == 0
    else:
        return ctx.path(path).exists