Skip to content

Commit

Permalink
fix(core): Conf parsing error always displays tauri.conf.json file …
Browse files Browse the repository at this point in the history
…name even when using toml or json5 (#10404)

* Conf parsing error displays `tauri.conf.json` when using toml or json5

Conf parsing error always displays `tauri.conf.json` as path, even when using `Tauri.toml` or `tauri.conf.json5`

Example Error Message when using Tauri.toml:
Error unable to parse toml Tauri config file at
/Users/bla/repo/bla/bla/src-tauri/tauri.conf.json because
invalid TOML value, did you mean to use a quoted string? at line 41
column 7

* merge changefile pr into main pr

* Update and rename fix-conf-parsing-error-filepath to fix-conf-parsing-error-filepath.md

---------

Co-authored-by: Fabian-Lars <[email protected]>
  • Loading branch information
ernstvanderlinden and FabianLars authored Jul 29, 2024
1 parent 2a402b4 commit 498f405
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .changes/fix-conf-parsing-error-filepath.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"tauri-utils": "patch:bug"
---

Fixed an issue where configuration parsing errors always displayed 'tauri.conf.json' as the file path, even when using 'Tauri.toml' or 'tauri.conf.json5'.

The error messages now correctly shows the actual config file being used.
4 changes: 2 additions & 2 deletions core/tauri-utils/src/config/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ fn do_parse<D: DeserializeOwned>(
#[cfg(feature = "config-json5")]
{
let raw = read_to_string(&json5)?;
do_parse_json5(&raw, &path).map(|config| (config, json5))
do_parse_json5(&raw, &json5).map(|config| (config, json5))
}

#[cfg(not(feature = "config-json5"))]
Expand All @@ -312,7 +312,7 @@ fn do_parse<D: DeserializeOwned>(
#[cfg(feature = "config-toml")]
{
let raw = read_to_string(&toml)?;
do_parse_toml(&raw, &path).map(|config| (config, toml))
do_parse_toml(&raw, &toml).map(|config| (config, toml))
}

#[cfg(not(feature = "config-toml"))]
Expand Down

0 comments on commit 498f405

Please sign in to comment.