fix(core): Conf parsing error always displays tauri.conf.json file 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 <fabianlars@fabianlars.de>
This commit is contained in:
Ernest M. van der Linden 2024-07-29 14:54:21 +02:00 committed by GitHub
parent 2a402b4845
commit 498f405ca8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -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.

View File

@ -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"))]
@ -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"))]