From 334832ded391f0d091446bb743140c4a14026e1d Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Fri, 17 Sep 2021 16:20:53 +0200 Subject: [PATCH] v0.2.6 --- CHANGELOG.md | 7 +++++-- Cargo.toml | 2 +- src/lib.rs | 11 +++++------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d588bd4..eef61e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,12 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] -## [v0.2.5] - 2021-09-17 +## [v0.2.6] - 2021-09-17 ### Added - support for suffixed Cargo configuration file (`.cargo/config.toml`) +## [v0.2.5] - 2021-09-17 - YANKED + ## [v0.2.4] - 2020-05-29 ### Fixed @@ -49,7 +51,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). First release -[Unreleased]: https://github.com/japaric/cargo-project/compare/v0.2.5...HEAD +[Unreleased]: https://github.com/japaric/cargo-project/compare/v0.2.6...HEAD +[v0.2.6]: https://github.com/japaric/cargo-project/compare/v0.2.5...v0.2.6 [v0.2.5]: https://github.com/japaric/cargo-project/compare/v0.2.4...v0.2.5 [v0.2.4]: https://github.com/japaric/cargo-project/compare/v0.2.3...v0.2.4 [v0.2.3]: https://github.com/japaric/cargo-project/compare/v0.2.2...v0.2.3 diff --git a/Cargo.toml b/Cargo.toml index daf08cf..a754cdc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ keywords = ["Cargo", "project", "subcommand"] license = "MIT OR Apache-2.0" name = "cargo-project" repository = "https://github.com/japaric/cargo-project" -version = "0.2.5" +version = "0.2.6" [dependencies] failure = "0.1.2" diff --git a/src/lib.rs b/src/lib.rs index b5091e1..cd62740 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -72,17 +72,16 @@ impl Project { // parse Cargo.toml let toml = root.join("Cargo.toml"); let cargo_config = Path::new(".cargo").join("config"); + let cargo_config_toml = cargo_config.with_extension("toml"); let manifest = parse::(&toml)?; // parse .cargo/config let mut target = None; let mut target_dir = env::var_os("CARGO_TARGET_DIR").map(PathBuf::from); - if let Some(path) = search(root, &cargo_config) { - let mut config_path = path.join(&cargo_config); - if !config_path.exists() { - config_path.set_extension("toml"); - } - let config: Config = parse(&config_path)?; + if let Some(path) = search(root, &cargo_config).map(|path| path.join(cargo_config)).or_else(|| { + search(root, &cargo_config_toml).map(|path| path.join(cargo_config_toml)) + }) { + let config: Config = parse(&path)?; if let Some(build) = config.build { target = build.target;