Allow to load files without case sensitive

This commit is contained in:
2025-12-12 23:01:09 +08:00
parent 552160ec86
commit 67ea0ff8e6
3 changed files with 4 additions and 1 deletions

View File

@@ -99,6 +99,7 @@ impl CrxdImage {
} else {
let mut nf = std::path::PathBuf::from(filename);
nf.set_file_name(name);
nf = crate::utils::files::get_ignorecase_path(&nf)?;
let f = std::fs::File::open(nf)?;
CrxImage::new(std::io::BufReader::new(f), config)?
}

View File

@@ -189,7 +189,8 @@ impl DpakLoader {
let dpak = match self.map.get(dpak) {
Some(d) => d,
None => {
let path = dir.join(dpak);
let mut path = dir.join(dpak);
path = crate::utils::files::get_ignorecase_path(&path)?;
let ndpak = Dpak::new(&path)?;
self.map.insert(dpak.to_string(), ndpak);
self.map.get(dpak).unwrap()

View File

@@ -99,6 +99,7 @@ impl SoftpalScript {
} else {
let mut path = std::path::PathBuf::from(filename);
path.set_file_name(name);
path = crate::utils::files::get_ignorecase_path(&path)?;
std::fs::read(path).map_err(|e| anyhow::anyhow!("Failed to read file {}: {}", name, e))
}
}