Most of the refactor. Need to switch machines.

This commit is contained in:
Olivia Brooks
2026-02-15 09:36:04 -05:00
parent dda863e512
commit e41d4bcd76
61 changed files with 3390 additions and 618 deletions

14
crates/fs/Cargo.toml Normal file
View File

@@ -0,0 +1,14 @@
[package]
name = "fs"
version = "0.1.0"
edition.workspace = true
license.workspace = true
description = "Raven's FS utilities"
repository.workspace = true
publish.workspace = true
test.workspace = true
[dependencies]
derive_more.workspace = true

24
crates/fs/src/lib.rs Normal file
View File

@@ -0,0 +1,24 @@
use std::path::{Path, PathBuf};
pub const EXT_TOML: &str = ".toml";
pub const EXT_LOCK: &str = ".lock";
pub fn expand_files<P: AsRef<Path>>(path: P) -> std::io::Result<Vec<PathBuf>> {
let path = path.as_ref();
if path.is_file() {
return Ok(vec![path.to_path_buf()]);
}
Ok(std::fs::read_dir(path)?
.filter_map(|entry| {
let path = entry.ok()?.path();
if path.is_dir() {
Some(expand_files(path).ok()?)
} else {
Some(vec![path])
}
})
.flatten()
.collect())
}