blob: 760a1aaba59b8ae5c71a59e1087f6e8ca0538e46 [file] [log] [blame]
// Copyright 2022 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use anyhow::Context as _;
use cm_rust::{ComponentDecl, FidlIntoNative};
use fidl::unpersist;
use fidl_fuchsia_component_decl as fdecl;
use std::{fs, path::Path};
pub fn load_manifest(cm: impl AsRef<Path>) -> anyhow::Result<ComponentDecl> {
let cm_raw = fs::read(cm).context("reading component manifest")?;
let component: fdecl::Component = unpersist(&cm_raw).context("decoding component manifest")?;
Ok(component.fidl_into_native())
}