mirror of
https://github.com/xlmnxp/blue-recorder.git
synced 2024-11-23 17:13:11 +03:00
fix(#22): ask before overwrite the file
This commit is contained in:
parent
1ae7461072
commit
fdb6765918
@ -15,6 +15,8 @@ use std::time::Duration;
|
||||
use subprocess::Exec;
|
||||
use zbus::dbus_proxy;
|
||||
use zvariant::Value;
|
||||
use gtk::{ButtonsType, DialogFlags, MessageType, MessageDialog, ResponseType};
|
||||
use gettextrs::gettext;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ProgressWidget {
|
||||
@ -137,6 +139,19 @@ impl Ffmpeg {
|
||||
.to_string(),
|
||||
);
|
||||
|
||||
let is_file_already_exists = std::path::Path::new(format!("{}", self.saved_filename.unwrap()))
|
||||
.exists();
|
||||
|
||||
if is_file_already_exists {
|
||||
if MessageDialog::new(None::<&Window>,
|
||||
DialogFlags::empty(),
|
||||
MessageType::Question,
|
||||
ButtonsType::Ok,
|
||||
&gettext("Would you like to overwrite this file?")).run() != ResponseType::Ok {
|
||||
return (None, None);
|
||||
}
|
||||
}
|
||||
|
||||
if self.record_audio.get_active() {
|
||||
let mut ffmpeg_command = Command::new("ffmpeg");
|
||||
ffmpeg_command.arg("-f");
|
||||
|
Loading…
Reference in New Issue
Block a user