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

@@ -4,6 +4,7 @@ use hbb_common::{allow_err, bail, log};
use libc::{c_char, c_int, c_void};
use std::{
cell::RefCell,
path::PathBuf,
sync::{
atomic::{AtomicBool, Ordering},
Arc,
@@ -516,6 +517,17 @@ pub fn get_active_username() -> String {
get_value_of_seat0(2)
}
pub fn get_active_user_home() -> Option<PathBuf> {
let username = get_active_username();
if !username.is_empty() {
let home = PathBuf::from(format!("/home/{}", username));
if home.exists() {
return Some(home);
}
}
None
}
pub fn is_prelogin() -> bool {
let n = get_active_userid().len();
n < 4 && n > 1