Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Cargo workspace config file #595

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Allow config file to live in parent folder (#595)

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion cargo-espflash/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ The configuration file allows you to define various parameters for your applicat

You can have a local and/or a global configuration file:

- For local configurations, store the file under the current working directory with the name `espflash.toml`
- For local configurations, store the file under the current working directory or in the parent directory (to support Cargo workspaces) with the name `espflash.toml`
- Global file location differs based on your operating system:
- Linux: `$HOME/.config/espflash/espflash.toml`
- macOS: `$HOME/Library/Application Support/rs.esp.espflash/espflash.toml`
Expand Down
2 changes: 1 addition & 1 deletion espflash/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ The configuration file allows you to define various parameters for your applicat

You can have a local and/or a global configuration file:

- For local configurations, store the file under the current working directory with the name `espflash.toml`
- For local configurations, store the file under the current working directory or in the parent directory (to support Cargo workspaces) with the name `espflash.toml`
- Global file location differs based on your operating system:
- Linux: `$HOME/.config/espflash/espflash.toml`
- macOS: `$HOME/Library/Application Support/rs.esp.espflash/espflash.toml`
Expand Down
6 changes: 6 additions & 0 deletions espflash/src/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ impl Config {
if local_config.exists() {
return Ok(local_config);
}
if let Some(parent_folder) = std::env::current_dir()?.parent() {
let workspace_config = parent_folder.join("espflash.toml");
if workspace_config.exists() {
return Ok(workspace_config);
}
}

let project_dirs = ProjectDirs::from("rs", "esp", "espflash").unwrap();
let global_config = project_dirs.config_dir().join("espflash.toml");
Expand Down
Loading