use an empty dom instead of an empty template

This commit is contained in:
Quaternions 2024-05-04 19:37:33 -07:00
parent 59deac0155
commit dde85fbf8a

View File

@ -1476,16 +1476,11 @@ enum TooComplicated<T>{
async fn compile(config:CompileConfig)->AResult<()>{
//basically decompile in reverse order
//load template dom
let input={
let template_path=config.template.unwrap_or_else(||{
let mut template_path=config.input_folder.clone();
template_path.push("template.rbxlx");
template_path
});
let mut dom=match config.template{
//mr dom doesn't like tokio files
std::io::BufReader::new(std::fs::File::open(template_path)?)
Some(template_path)=>load_dom(std::io::BufReader::new(std::fs::File::open(template_path)?))?,
None=>rbx_dom_weak::WeakDom::default(),
};
let mut dom=load_dom(input)?;
//hack to traverse root folder as the root object
dom.root_mut().name="src".to_owned();