mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-01 22:51:28 +03:00
installed windows client save incoming recording to a specific directory (#7974)
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
@@ -26,7 +26,7 @@ const MIN_SECS: u64 = 1;
|
||||
pub struct RecorderContext {
|
||||
pub server: bool,
|
||||
pub id: String,
|
||||
pub default_dir: String,
|
||||
pub dir: String,
|
||||
pub filename: String,
|
||||
pub width: usize,
|
||||
pub height: usize,
|
||||
@@ -36,18 +36,11 @@ pub struct RecorderContext {
|
||||
|
||||
impl RecorderContext {
|
||||
pub fn set_filename(&mut self) -> ResultType<()> {
|
||||
let mut dir = Config::get_option("video-save-directory");
|
||||
if !dir.is_empty() {
|
||||
if !PathBuf::from(&dir).exists() {
|
||||
std::fs::create_dir_all(&dir)?;
|
||||
}
|
||||
} else {
|
||||
dir = self.default_dir.clone();
|
||||
if !dir.is_empty() && !PathBuf::from(&dir).exists() {
|
||||
std::fs::create_dir_all(&dir)?;
|
||||
}
|
||||
if !PathBuf::from(&self.dir).exists() {
|
||||
std::fs::create_dir_all(&self.dir)?;
|
||||
}
|
||||
let file = if self.server { "s" } else { "c" }.to_string()
|
||||
let file = if self.server { "incoming" } else { "outgoing" }.to_string()
|
||||
+ "_"
|
||||
+ &self.id.clone()
|
||||
+ &chrono::Local::now().format("_%Y%m%d%H%M%S%3f_").to_string()
|
||||
+ &self.format.to_string().to_lowercase()
|
||||
@@ -59,7 +52,10 @@ impl RecorderContext {
|
||||
} else {
|
||||
".mp4"
|
||||
};
|
||||
self.filename = PathBuf::from(&dir).join(file).to_string_lossy().to_string();
|
||||
self.filename = PathBuf::from(&self.dir)
|
||||
.join(file)
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
log::info!("video will save to {}", self.filename);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user