@@ -6,7 +6,7 @@ use std::{
66 process:: Command ,
77} ;
88
9- use anyhow:: { bail, Result } ;
9+ use anyhow:: { bail, Context , Result } ;
1010use cargo:: CargoAction ;
1111use clap:: ValueEnum ;
1212use esp_metadata:: Chip ;
@@ -151,7 +151,8 @@ pub fn load_examples(path: &Path) -> Result<Vec<Metadata>> {
151151
152152 for entry in fs:: read_dir ( path) ? {
153153 let path = windows_safe_path ( & entry?. path ( ) ) ;
154- let text = fs:: read_to_string ( & path) ?;
154+ let text = fs:: read_to_string ( & path)
155+ . with_context ( || format ! ( "Could not read {}" , path. display( ) ) ) ?;
155156
156157 let mut chips = Vec :: new ( ) ;
157158 let mut features = Vec :: new ( ) ;
@@ -184,7 +185,7 @@ pub fn load_examples(path: &Path) -> Result<Vec<Metadata>> {
184185 } else if key == "FEATURES" {
185186 features = split. into ( ) ;
186187 } else {
187- log:: warn!( "Unregognized metadata key '{key}', ignoring" ) ;
188+ log:: warn!( "Unrecognized metadata key '{key}', ignoring" ) ;
188189 }
189190 }
190191
@@ -309,7 +310,8 @@ pub fn build_package(
309310/// Bump the version of the specified package by the specified amount.
310311pub fn bump_version ( workspace : & Path , package : Package , amount : Version ) -> Result < ( ) > {
311312 let manifest_path = workspace. join ( package. to_string ( ) ) . join ( "Cargo.toml" ) ;
312- let manifest = fs:: read_to_string ( & manifest_path) ?;
313+ let manifest = fs:: read_to_string ( & manifest_path)
314+ . with_context ( || format ! ( "Could not read {}" , manifest_path. display( ) ) ) ?;
313315
314316 let mut manifest = manifest. parse :: < toml_edit:: DocumentMut > ( ) ?;
315317
@@ -528,7 +530,10 @@ pub fn package_version(workspace: &Path, package: Package) -> Result<semver::Ver
528530 version : semver:: Version ,
529531 }
530532
531- let manifest = fs:: read_to_string ( workspace. join ( package. to_string ( ) ) . join ( "Cargo.toml" ) ) ?;
533+ let path = workspace. join ( package. to_string ( ) ) . join ( "Cargo.toml" ) ;
534+ let path = windows_safe_path ( & path) ;
535+ let manifest =
536+ fs:: read_to_string ( & path) . with_context ( || format ! ( "Could not read {}" , path. display( ) ) ) ?;
532537 let manifest: Manifest = basic_toml:: from_str ( & manifest) ?;
533538
534539 Ok ( manifest. package . version )
0 commit comments