forked from rojo-rbx/rojo
Defer application of init.meta.json until after init Lua files. (#549)
Fixes #546.
This commit is contained in:
committed by
GitHub
parent
c06463b61d
commit
e5dbee1073
@@ -6,7 +6,11 @@ use memofs::{IoResultExt, Vfs};
|
||||
|
||||
use crate::snapshot::{InstanceContext, InstanceMetadata, InstanceSnapshot};
|
||||
|
||||
use super::{dir::snapshot_dir, meta_file::AdjacentMetadata, util::match_trailing};
|
||||
use super::{
|
||||
dir::{dir_meta, snapshot_dir_no_meta},
|
||||
meta_file::AdjacentMetadata,
|
||||
util::match_trailing,
|
||||
};
|
||||
|
||||
/// Core routine for turning Lua files into snapshots.
|
||||
pub fn snapshot_lua(
|
||||
@@ -66,7 +70,7 @@ pub fn snapshot_lua_init(
|
||||
init_path: &Path,
|
||||
) -> anyhow::Result<Option<InstanceSnapshot>> {
|
||||
let folder_path = init_path.parent().unwrap();
|
||||
let dir_snapshot = snapshot_dir(context, vfs, folder_path)?.unwrap();
|
||||
let dir_snapshot = snapshot_dir_no_meta(context, vfs, folder_path)?.unwrap();
|
||||
|
||||
if dir_snapshot.class_name != "Folder" {
|
||||
anyhow::bail!(
|
||||
@@ -86,6 +90,10 @@ pub fn snapshot_lua_init(
|
||||
init_snapshot.children = dir_snapshot.children;
|
||||
init_snapshot.metadata = dir_snapshot.metadata;
|
||||
|
||||
if let Some(mut meta) = dir_meta(vfs, folder_path)? {
|
||||
meta.apply_all(&mut init_snapshot)?;
|
||||
}
|
||||
|
||||
Ok(Some(init_snapshot))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user