Skip to content

Commit

Permalink
Fix config search (#23)
Browse files Browse the repository at this point in the history
* Remove Cargo.toml restriction

Also prints a warning when no about.toml
can be found to alert the user it's going to
use the defualt configuration

* Display richer error information

* Update CHANGELOG
  • Loading branch information
Jake-Shadle authored Dec 12, 2019
1 parent 0a0cc68 commit 78f1b90
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- [#20](https://github.com/EmbarkStudios/cargo-about/pull/20) Fewer files are now scanned for license information
- [#21](https://github.com/EmbarkStudios/cargo-about/pull/21) Pipes in the file system are now ignored on unix systems
- [#23](https://github.com/EmbarkStudios/cargo-about/pull/23) Fixes searching for the `about.toml` configuration file

## [0.1.0] - 2019-12-06


## [0.0.1] - 2019-11-07
### Added
- Initial add of the thing
Expand Down
16 changes: 12 additions & 4 deletions src/cargo-about/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,16 @@ fn load_config(manifest_path: &Path) -> Result<cargo_about::licenses::config::Co
// cases where eg in a workspace there is a top-level about.toml
// but the user is only getting a listing for a particular crate from it
while let Some(p) = parent {
if !p.join("Cargo.toml").exists() {
break;
}
// We _could_ limit ourselves to only directories that also have a Cargo.toml
// in them, but there could be cases where someone has multiple
// rust projects in subdirectories with a single top level about.toml that is
// used across all of them, we could also introduce a metadata entry for the
// relative path of the about.toml to use for the crate/workspace

// if !p.join("Cargo.toml").exists() {
// parent = p.parent();
// continue;
// }

let about_toml = p.join("about.toml");

Expand All @@ -99,6 +106,7 @@ fn load_config(manifest_path: &Path) -> Result<cargo_about::licenses::config::Co
parent = p.parent();
}

log::warn!("no 'about.toml' found, falling back to default configuration");
Ok(cargo_about::licenses::config::Config::default())
}

Expand Down Expand Up @@ -160,7 +168,7 @@ fn main() {
match real_main() {
Ok(_) => {}
Err(e) => {
log::error!("{}", e);
log::error!("{:#}", e);
std::process::exit(1);
}
}
Expand Down

0 comments on commit 78f1b90

Please sign in to comment.