fix(win): Fix crash on start on Windows

This commit is contained in:
Andreas Mieke 2023-11-16 01:13:05 +01:00
parent 676c922a3a
commit 78c2ac3459
3 changed files with 12 additions and 1 deletions

10
Cargo.lock generated
View file

@ -445,6 +445,15 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
[[package]]
name = "home"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb"
dependencies = [
"windows-sys",
]
[[package]]
name = "http"
version = "0.2.9"
@ -835,6 +844,7 @@ name = "plex-media-ingest"
version = "0.1.0"
dependencies = [
"clap",
"home",
"infer",
"inline_colorization",
"inquire",

View file

@ -7,6 +7,7 @@ edition = "2021"
[dependencies]
clap = { version = "4.4.7", features = ["derive"] }
home = "0.5.5"
infer = "0.15.0"
inline_colorization = "0.1.6"
inquire = "0.6.2"

View file

@ -57,7 +57,7 @@ fn main() {
// Set config path config to home folder, or if provided to specified file
let config_path = if args.config.is_none() {
PathBuf::from(std::env::var("HOME").unwrap()).join(".plex-media-ingest").join("config.json")
PathBuf::from(home::home_dir().unwrap_or_default()).join(".plex-media-ingest").join("config.json")
} else {
args.config.unwrap()
};