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 {
|
loop {
|
||||||
match watch_rx.recv() {
|
match watch_rx.recv() {
|
||||||
Ok(event) => {
|
Ok(event) => {
|
||||||
println!("Event: {:?}", event);
|
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
DebouncedEvent::Create(path) | DebouncedEvent::Write(path) => {
|
DebouncedEvent::Create(path) | DebouncedEvent::Write(path) => {
|
||||||
let mut vfs = vfs.lock().unwrap();
|
let mut vfs = vfs.lock().unwrap();
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ use std::{
|
||||||
io,
|
io,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Vfs {
|
pub struct Vfs {
|
||||||
contents: HashMap<PathBuf, Vec<u8>>,
|
contents: HashMap<PathBuf, Vec<u8>>,
|
||||||
items: HashMap<PathBuf, VfsItem>,
|
items: HashMap<PathBuf, VfsItem>,
|
||||||
|
|
@ -79,26 +80,18 @@ impl Vfs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct VfsFile {
|
pub struct VfsFile {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VfsFile {
|
#[derive(Debug)]
|
||||||
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())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct VfsDirectory {
|
pub struct VfsDirectory {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
children: HashSet<PathBuf>,
|
children: HashSet<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub enum VfsItem {
|
pub enum VfsItem {
|
||||||
File(VfsFile),
|
File(VfsFile),
|
||||||
Directory(VfsDirectory),
|
Directory(VfsDirectory),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue