Revert "Cross platform fix"

This reverts commit 42e48d8930.
This commit is contained in:
h3cx committed 2026-03-12 21:24:42 +01:00
1 parent 42e48d8930
commit acec9a3ce0
3 files changed
+11 -356

No files matched your search

+10 -22
View File
@@ -2,15 +2,9 @@ use std::{
env, fs,
path::{self, Path, PathBuf},
sync::mpsc,
thread::sleep,
time::Duration,
};
use notify::{
Event, EventKind, RecursiveMode, Watcher,
event::{CreateKind, ModifyKind},
};
use notify_debouncer_mini::{DebouncedEvent, new_debouncer};
use notify::{Event, EventKind, RecursiveMode, Watcher, event::CreateKind};
use serde::{Deserialize, Serialize};
use thiserror::Error;
@@ -71,28 +65,22 @@ fn main() -> notify::Result<()> {
println!("{:?}", config.libraries.unwrap().symacsys_symbols.unwrap());
}
}
let (tx, rx) = mpsc::channel::<Result<Vec<DebouncedEvent>, notify::Error>>();
let mut debouncer = new_debouncer(Duration::from_secs(2), tx)?;
let (tx, rx) = mpsc::channel::<notify::Result<Event>>();
let mut watcher = notify::recommended_watcher(tx)?;
let downloads = PathBuf::from(env::var("HOME").unwrap()).join("Downloads");
println!("{:?}", downloads);
debouncer
.watcher()
.watch(&downloads, RecursiveMode::NonRecursive)?;
watcher.watch(&downloads, RecursiveMode::NonRecursive)?;
for res in rx {
match res {
Ok(events) => {
println!("{:?}", events.len());
let event = events[0].clone();
let path = event.path;
if !validate_zip(&path) {
Ok(event) => {
if event.kind != EventKind::Create(CreateKind::File) {
continue;
}
if !validate_zip(&event.paths[0]) {
continue;
}
let Ok(source_type) = find_source_type(&path) else {
let Ok(source_type) = find_source_type(&event.paths[0]) else {
continue;
};