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 crate::Error;
|
||||||
|
use std::env::var;
|
||||||
use std::fmt::{Debug, Formatter};
|
use std::fmt::{Debug, Formatter};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
@ -33,12 +34,15 @@ impl Loader {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_opt_pack(pack: Option<Packfile>) -> Result<Self, Error> {
|
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")?
|
.ok_or("Can't find steam directory")?
|
||||||
.app(&440)
|
.app(&440)
|
||||||
.ok_or("Can't find tf2 directory")?
|
.ok_or("Can't find tf2 directory")?
|
||||||
.path
|
.path
|
||||||
.join("tf");
|
.join("tf"),
|
||||||
|
};
|
||||||
let download = tf_dir.join("download");
|
let download = tf_dir.join("download");
|
||||||
let vpks = tf_dir
|
let vpks = tf_dir
|
||||||
.read_dir()?
|
.read_dir()?
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue