mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Add Debug, remove prints
This commit is contained in:
parent
1896e97451
commit
008f50efd7
2 changed files with 4 additions and 13 deletions
|
|
@ -87,8 +87,6 @@ impl Session {
|
|||
loop {
|
||||
match watch_rx.recv() {
|
||||
Ok(event) => {
|
||||
println!("Event: {:?}", event);
|
||||
|
||||
match event {
|
||||
DebouncedEvent::Create(path) | DebouncedEvent::Write(path) => {
|
||||
let mut vfs = vfs.lock().unwrap();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use std::{
|
|||
io,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Vfs {
|
||||
contents: HashMap<PathBuf, Vec<u8>>,
|
||||
items: HashMap<PathBuf, VfsItem>,
|
||||
|
|
@ -79,26 +80,18 @@ impl Vfs {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct VfsFile {
|
||||
path: PathBuf,
|
||||
}
|
||||
|
||||
impl VfsFile {
|
||||
pub fn read_contents<'file, 'vfs>(&'file self, vfs: &'vfs mut Vfs) -> io::Result<&'vfs [u8]> {
|
||||
if !vfs.contents.contains_key(&self.path) {
|
||||
let contents = fs::read(&self.path)?;
|
||||
vfs.contents.insert(self.path.clone(), contents);
|
||||
}
|
||||
|
||||
Ok(vfs.contents.get(&self.path).unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct VfsDirectory {
|
||||
path: PathBuf,
|
||||
children: HashSet<PathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum VfsItem {
|
||||
File(VfsFile),
|
||||
Directory(VfsDirectory),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue