mirror of
https://codeberg.org/icewind/tf-asset-loader.git
synced 2026-06-03 16:44:10 +02:00
add option to manually specify the tf2 directory
This commit is contained in:
parent
5af8ad8293
commit
2d3221c5b8
1 changed files with 7 additions and 1 deletions
|
|
@ -24,7 +24,7 @@ pub use source::AssetSource;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::env::var_os;
|
use std::env::var_os;
|
||||||
use std::fmt::{Debug, Display, Formatter};
|
use std::fmt::{Debug, Display, Formatter};
|
||||||
use std::path::PathBuf;
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use steamlocate::SteamDir;
|
use steamlocate::SteamDir;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
@ -74,6 +74,12 @@ impl Loader {
|
||||||
/// Create the loader, either auto-detecting the tf2 directory or from the `TF_DIR` environment variable.
|
/// Create the loader, either auto-detecting the tf2 directory or from the `TF_DIR` environment variable.
|
||||||
pub fn new() -> Result<Self, LoaderError> {
|
pub fn new() -> Result<Self, LoaderError> {
|
||||||
let tf2_dir = tf2_path()?;
|
let tf2_dir = tf2_path()?;
|
||||||
|
Self::with_tf2_dir(tf2_dir)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create the loader with the specified tf2 directory.
|
||||||
|
pub fn with_tf2_dir<P: AsRef<Path>>(tf2_dir: P) -> Result<Self, LoaderError> {
|
||||||
|
let tf2_dir = tf2_dir.as_ref();
|
||||||
|
|
||||||
let tf_dir = tf2_dir.join("tf");
|
let tf_dir = tf2_dir.join("tf");
|
||||||
let hl_dir = tf2_dir.join("hl2");
|
let hl_dir = tf2_dir.join("hl2");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue