mirror of
https://codeberg.org/icewind/vbspview.git
synced 2026-06-03 18:24:09 +02:00
minor loader changes
This commit is contained in:
parent
04bfb51bf4
commit
81faa646c5
2 changed files with 5 additions and 3 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -1,3 +1,5 @@
|
||||||
/target
|
/target
|
||||||
*.bsp
|
*.bsp
|
||||||
*.obj
|
*.obj
|
||||||
|
perf.data*
|
||||||
|
flamegraph.svg
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ impl Loader {
|
||||||
.read_dir()?
|
.read_dir()?
|
||||||
.filter_map(|item| item.ok())
|
.filter_map(|item| item.ok())
|
||||||
.filter_map(|item| Some(item.path().to_str()?.to_string()))
|
.filter_map(|item| Some(item.path().to_str()?.to_string()))
|
||||||
.filter(|path| path.ends_with(".vpk"))
|
.filter(|path| path.ends_with("dir.vpk"))
|
||||||
.map(|path| vpk::from_path(&path))
|
.map(|path| vpk::from_path(&path))
|
||||||
.filter_map(|res| res.ok())
|
.filter_map(|res| res.ok())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
@ -42,7 +42,7 @@ impl Loader {
|
||||||
|
|
||||||
#[tracing::instrument]
|
#[tracing::instrument]
|
||||||
pub fn load(&self, name: &str) -> Result<Vec<u8>, Error> {
|
pub fn load(&self, name: &str) -> Result<Vec<u8>, Error> {
|
||||||
debug!("loading file");
|
debug!("loading {}", name);
|
||||||
if let Some(data) = self.pack.get(name)? {
|
if let Some(data) = self.pack.get(name)? {
|
||||||
debug!("got {} bytes from packfile", data.len());
|
debug!("got {} bytes from packfile", data.len());
|
||||||
return Ok(data);
|
return Ok(data);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue