Commit 5f717aec authored by Sophie Herold's avatar Sophie Herold

Fetch volume and device info at repo create

Fixes #30
parent 6dffb549
......@@ -89,15 +89,16 @@ impl BackupConfig {
}
pub fn new_from_path(repo: &path::Path) -> Self {
let repo_file = gio::File::new_for_path(&repo);
let repo_file = gio::File::new_for_path(&if repo.exists() {
repo
} else {
// for new repos the repo directory itself usually doesen't exist
repo.parent().unwrap_or(repo)
});
let none: Option<&gio::Cancellable> = None;
let mount = repo_file.find_enclosing_mount(none).ok();
debug!(
"Mount found: {:?} {:?} {:?}",
&repo,
&mount,
repo_file.is_native()
);
debug!("Mount found: {:?} {:?} {:?}", &repo, &mount, repo_file);
let drive = mount.as_ref().and_then(gio::Mount::get_drive);
let volume_uuid = mount.as_ref().and_then(get_mount_uuid);
......
......@@ -4,7 +4,6 @@ use std::io::prelude::*;
use gdk_pixbuf::prelude::*;
use gio::prelude::*;
use gtk::prelude::*;
use glib;
use crate::borg;
use crate::shared;
......
use gio;
use gio::prelude::*;
use gtk::prelude::*;
use std::rc::Rc;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment