fix default video save directory

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2022-10-12 16:06:15 +08:00
parent e94c3467eb
commit 150057f92d
9 changed files with 87 additions and 32 deletions

View File

@@ -10,6 +10,7 @@ use std::io::prelude::*;
use std::{
ffi::{CString, OsString},
fs, io, mem,
path::PathBuf,
sync::{Arc, Mutex},
time::{Duration, Instant},
};
@@ -734,6 +735,18 @@ pub fn get_active_username() -> String {
.to_owned()
}
pub fn get_active_user_home() -> Option<PathBuf> {
let username = get_active_username();
if !username.is_empty() {
let drive = std::env::var("SystemDrive").unwrap_or("C:".to_owned());
let home = PathBuf::from(format!("{}\\Users\\{}", drive, username));
if home.exists() {
return Some(home);
}
}
None
}
pub fn is_prelogin() -> bool {
let username = get_active_username();
username.is_empty() || username == "SYSTEM"