Skip to content

Commit 14befdc

Browse files
Allow Cargo workspace config file (#595)
* feat: Allow Cargo workspace config file * docs: Update changelog
1 parent 3ab8614 commit 14befdc

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11+
- Allow config file to live in parent folder (#595)
1112

1213
### Fixed
1314
- Change the `hard_reset` sequence to fix Windows issues (#594)

cargo-espflash/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ The configuration file allows you to define various parameters for your applicat
140140

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

143-
- For local configurations, store the file under the current working directory with the name `espflash.toml`
143+
- 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`
144144
- Global file location differs based on your operating system:
145145
- Linux: `$HOME/.config/espflash/espflash.toml`
146146
- macOS: `$HOME/Library/Application Support/rs.esp.espflash/espflash.toml`

espflash/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ The configuration file allows you to define various parameters for your applicat
154154

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

157-
- For local configurations, store the file under the current working directory with the name `espflash.toml`
157+
- 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`
158158
- Global file location differs based on your operating system:
159159
- Linux: `$HOME/.config/espflash/espflash.toml`
160160
- macOS: `$HOME/Library/Application Support/rs.esp.espflash/espflash.toml`

espflash/src/cli/config.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ impl Config {
101101
if local_config.exists() {
102102
return Ok(local_config);
103103
}
104+
if let Some(parent_folder) = std::env::current_dir()?.parent() {
105+
let workspace_config = parent_folder.join("espflash.toml");
106+
if workspace_config.exists() {
107+
return Ok(workspace_config);
108+
}
109+
}
104110

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

0 commit comments

Comments
 (0)