Skip to content

Commit a1929c6

Browse files
authored
fix(cli): always read custom config file from CWD, closes #4067 (#4074)
1 parent 35f2147 commit a1929c6

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

.changes/dev-cmd-config-arg.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"cli.rs": patch
3+
"cli.js": patch
4+
---
5+
6+
**Breaking change:** The `dev` command now reads the custom config file from CWD instead of the Tauri folder.

tooling/cli/src/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub fn command(options: Options) -> Result<()> {
5050
Some(if config.starts_with('{') {
5151
config.to_string()
5252
} else {
53-
std::fs::read_to_string(&config)?
53+
std::fs::read_to_string(&config).with_context(|| "failed to read custom configuration")?
5454
})
5555
} else {
5656
None

tooling/cli/src/dev.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,18 @@ pub fn command(options: Options) -> Result<()> {
7979

8080
fn command_internal(options: Options) -> Result<()> {
8181
let tauri_path = tauri_dir();
82-
set_current_dir(&tauri_path).with_context(|| "failed to change current working directory")?;
8382
let merge_config = if let Some(config) = &options.config {
8483
Some(if config.starts_with('{') {
8584
config.to_string()
8685
} else {
87-
std::fs::read_to_string(&config)?
86+
std::fs::read_to_string(&config).with_context(|| "failed to read custom configuration")?
8887
})
8988
} else {
9089
None
9190
};
91+
92+
set_current_dir(&tauri_path).with_context(|| "failed to change current working directory")?;
93+
9294
let config = get_config(merge_config.as_deref())?;
9395

9496
if let Some(before_dev) = &config

0 commit comments

Comments
 (0)