mirror of
https://codeberg.org/icewind/vbspview.git
synced 2026-06-03 18:24:09 +02:00
allow overwriding tf directory
This commit is contained in:
parent
57a73d32f4
commit
294b93253d
1 changed files with 10 additions and 6 deletions
|
|
@ -1,4 +1,5 @@
|
|||
use crate::Error;
|
||||
use std::env::var;
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
|
@ -33,12 +34,15 @@ impl Loader {
|
|||
}
|
||||
|
||||
pub fn with_opt_pack(pack: Option<Packfile>) -> Result<Self, Error> {
|
||||
let tf_dir = SteamDir::locate()
|
||||
let tf_dir = match var("TF_DIR") {
|
||||
Ok(dir) => PathBuf::from(dir).join("tf"),
|
||||
Err(_) => SteamDir::locate()
|
||||
.ok_or("Can't find steam directory")?
|
||||
.app(&440)
|
||||
.ok_or("Can't find tf2 directory")?
|
||||
.path
|
||||
.join("tf");
|
||||
.join("tf"),
|
||||
};
|
||||
let download = tf_dir.join("download");
|
||||
let vpks = tf_dir
|
||||
.read_dir()?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue