Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match file extensions against blacklist to avoid multiple rebuilds tr… #39

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ mod mesh;
mod model;
mod window;

use std::collections::HashSet;
use std::ffi::OsStr;
use std::{collections::HashMap, sync::mpsc, time::Instant};

use futures::executor::block_on;
Expand Down Expand Up @@ -139,6 +141,24 @@ fn main() -> anyhow::Result<()> {
notify::event::DataChange::Content,
)) = event.kind
{
let file_ext = event
.paths
.get(0)
.expect("File path missing in watch event")
.extension();

let black_list = HashSet::from([
OsStr::new("swp"),
OsStr::new("tmp"),
OsStr::new("swx"),
]);

if let Some(ext) = file_ext {
if black_list.contains(ext) {
return;
}
}

let shape = match model.load(&parameters) {
Ok(shape) => shape,
Err(model::Error::Compile) => {
Expand Down