pub fn build(&self, gendir: impl AsRef<Path>, output: impl AsRef<Path>) -> Result<()> {
        // Delete the output file if it exists.
        if output.as_ref().exists() {
            std::fs::remove_file(&output).context(format!(
                "Failed to delete previous blobfs file: {}",
                output.as_ref().display()
            ))?;
        }

        // Write the blob manifest.
        let blob_manifest_path = gendir.as_ref().join("blob.manifest");
        self.manifest.write(&blob_manifest_path).context("Failed to write to blob.manifest")?;

        // Build the arguments vector.
        let blobs_json_path = gendir.as_ref().join("blobs.json");
        let blobfs_args =
            build_blobfs_args(self.layout.clone(), &blob_manifest_path, blobs_json_path, output)?;

        // Run the blobfs tool.
        // TODO(fxbug.dev/76378): Take the tool location from a config.
        let output = std::process::Command::new("host_x64/blobfs").args(&blobfs_args).output();
        let output = output.context("Failed to run the blobfs tool")?;
        if !output.status.success() {
            anyhow::bail!(format!("Failed to generate blobfs with output: {:?}", output));
        }
        Ok(())
    }
/// Build blobfs, and write it to `output`, while placing intermediate files in `gendir`.
Build blobfs, and write it to `output`, while placing intermediate files in `gendir`.
Build blobfs and write it to ` output ` while placing intermediate files in ` gendir ` .
pub fn build(&self, gendir: impl AsRef<Path>, output: impl AsRef<Path>) -> Result<()> {
        // Delete the output file if it exists.
        if output.as_ref().exists() {
            std::fs::remove_file(&output).context(format!(
                "Failed to delete previous blobfs file: {}",
                output.as_ref().display()
            ))?;
        }
        // Write the blob manifest.
        let blob_manifest_path = gendir.as_ref().join("blob.manifest");
        self.manifest.write(&blob_manifest_path).context("Failed to write to blob.manifest")?;
        // Build the arguments vector.
        let blobs_json_path = gendir.as_ref().join("blobs.json");
        let blobfs_args =
            build_blobfs_args(self.layout.clone(), &blob_manifest_path, blobs_json_path, output)?;
        // Run the blobfs tool.
        // TODO(fxbug.dev/76378): Take the tool location from a config.
        let output = std::process::Command::new("host_x64/blobfs").args(&blobfs_args).output();
        let output = output.context("Failed to run the blobfs tool")?;
        if !output.status.success() {
            anyhow::bail!(format!("Failed to generate blobfs with output: {:?}", output));
        }
        Ok(())
    }
pub fn build ( & self , gendir : impl AsRef < Path > , output : impl AsRef < Path > ) -> Result < ( ) > { // Delete the output file if it exists. if output . as_ref ( ) . exists ( ) { std :: fs :: remove_file ( & output ) . context ( format ! ( " " output as_ref ( ) display ( ) ) ) ? ; } // Write the blob manifest. let blob_manifest_path = gendir . as_ref ( ) . join ( " " ) ; self . manifest . write ( & blob_manifest_path ) . context ( " " ) ? ; // Build the arguments vector. let blobs_json_path = gendir . as_ref ( ) . join ( " " ) ; let blobfs_args = build_blobfs_args ( self . layout . clone ( ) , & blob_manifest_path , blobs_json_path , output ) ? ; // Run the blobfs tool. // TODO(fxbug.dev/76378): Take the tool location from a config. let output = std :: process :: Command :: new ( " " ) . args ( & blobfs_args ) . output ( ) ; let output = output . context ( " " ) ? ; if ! output . status . success ( ) { anyhow :: bail ! ( format ( " " output ) ) ; } Ok ( ( ) ) }
Build blobfs, and write it to `output`, while placing intermediate files in `gendir`.
Build blobfs and write it to ` output ` while placing intermediate files in ` gendir ` .
&self
gendir
impl AsRef<Path>
output
impl AsRef<Path>
&self
gendir
impl AsRef<Path>
output
impl AsRef<Path>