fix for registry_save_path

This commit is contained in:
joergf2a 2024-10-25 22:59:22 +11:00
parent d5f14bc037
commit 39e6a2ccd2

View File

@ -1,19 +1,21 @@
use crate::{AssetRoot, BlenvyConfig}; use crate::{AssetRoot, BlenvyConfig};
use bevy::{ use bevy::{
log::info, asset::io::file::FileAssetReader,
prelude::{AppTypeRegistry, ReflectComponent, ReflectResource, World}, log::info,
prelude::{AppTypeRegistry, ReflectComponent, ReflectResource, World},
reflect::{TypeInfo, TypeRegistration, VariantInfo}, reflect::{TypeInfo, TypeRegistration, VariantInfo},
}; };
use serde_json::{json, Map, Value}; use serde_json::{json, Map, Value};
use std::{fs::File, path::Path}; use std::fs::File;
pub fn export_types(world: &mut World) { pub fn export_types(world: &mut World) {
let config = world let config = world
.get_resource::<BlenvyConfig>() .get_resource::<BlenvyConfig>()
.expect("ExportComponentsConfig should exist at this stage"); .expect("ExportComponentsConfig should exist at this stage");
let base_path = FileAssetReader::get_base_path();
let asset_root = world.resource::<AssetRoot>(); let asset_root = world.resource::<AssetRoot>();
let registry_save_path = Path::join(&asset_root.0, &config.registry_save_path); let registry_save_path = base_path.join(&asset_root.0).join(&config.registry_save_path);
let writer = File::create(registry_save_path).expect("should have created schema file"); let writer = File::create(registry_save_path).expect("should have created schema file");
let components_to_filter_out = &config.registry_component_filter.clone(); let components_to_filter_out = &config.registry_component_filter.clone();