Przeglądaj źródła

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>
Ernest M. van der Linden 1 rok temu
rodzic
commit
498f405ca8

+ 7 - 0
.changes/fix-conf-parsing-error-filepath.md

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

+ 2 - 2
core/tauri-utils/src/config/parse.rs

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