mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-24 06:34:09 +00:00
Orchestrate communication between RbxSession and VfsSession
This commit is contained in:
parent
cb548719b2
commit
5acbc9f967
4 changed files with 101 additions and 67 deletions
|
|
@ -58,6 +58,22 @@ impl VfsSession {
|
|||
println!("Got change {:?}", change);
|
||||
}
|
||||
|
||||
pub fn get_file_item(&self, route: &FileRoute) -> Option<&FileItem> {
|
||||
let partition = self.partition_files.get(&route.partition)?;
|
||||
let mut current = partition;
|
||||
|
||||
for piece in &route.route {
|
||||
match current {
|
||||
FileItem::File { .. } => return None,
|
||||
FileItem::Directory { children, .. } => {
|
||||
current = children.get(piece)?;
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Some(current)
|
||||
}
|
||||
|
||||
fn read(&self, route: &FileRoute) -> Result<FileItem, ()> {
|
||||
let partition_path = &self.config.partitions.get(&route.partition)
|
||||
.ok_or(())?.path;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue