mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-01 10:01:07 +02:00
This commit is contained in:
5
.changes/issue-4723.md
Normal file
5
.changes/issue-4723.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri-codegen": patch
|
||||
---
|
||||
|
||||
Fix relative paths in `version` field of `tauri.config.json` not being correctly parsed by `generate_context!()`.
|
||||
@@ -64,5 +64,14 @@ pub fn get_config(path: &Path) -> Result<(Config, PathBuf), CodegenConfigError>
|
||||
json_patch::merge(&mut config, &merge_config);
|
||||
}
|
||||
|
||||
Ok((serde_json::from_value(config)?, parent))
|
||||
let old_cwd = std::env::current_dir().map_err(CodegenConfigError::CurrentDir)?;
|
||||
// Set working directory to where `tauri.config.json` is, so that relative paths in it are parsed correctly.
|
||||
std::env::set_current_dir(parent.clone()).map_err(CodegenConfigError::CurrentDir)?;
|
||||
|
||||
let config = serde_json::from_value(config)?;
|
||||
|
||||
// Reset workding directory.
|
||||
std::env::set_current_dir(old_cwd).map_err(CodegenConfigError::CurrentDir)?;
|
||||
|
||||
Ok((config, parent))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user