|
@@ -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))
|
|
|
}
|