Fixed name map inheritance for repositories (re #2)

This commit is contained in:
Dennis Schwerdel 2017-04-12 15:47:26 +02:00
parent 3da0a1d4ed
commit 259b12e35f
1 changed files with 6 additions and 4 deletions

View File

@ -157,11 +157,11 @@ impl<'a> FuseFilesystem<'a> {
let mut backups = vec![]; let mut backups = vec![];
for (name, backup) in try!(repository.get_backups()) { for (name, backup) in try!(repository.get_backups()) {
let inode = try!(repository.get_inode(&backup.root)); let inode = try!(repository.get_inode(&backup.root));
backups.push((name, inode)); backups.push((name, backup, inode));
} }
let mut fs = try!(FuseFilesystem::new(repository)); let mut fs = try!(FuseFilesystem::new(repository));
let root = fs.add_virtual_directory("".to_string(), None); let root = fs.add_virtual_directory("".to_string(), None);
for (name, mut backup) in backups { for (name, backup, mut inode) in backups {
let mut parent = root.clone(); let mut parent = root.clone();
for part in name.split('/') { for part in name.split('/') {
parent = match fs.get_child(&parent, part).unwrap() { parent = match fs.get_child(&parent, part).unwrap() {
@ -170,8 +170,10 @@ impl<'a> FuseFilesystem<'a> {
}; };
} }
let mut parent_mut = parent.borrow_mut(); let mut parent_mut = parent.borrow_mut();
backup.name = parent_mut.inode.name.clone(); inode.name = parent_mut.inode.name.clone();
parent_mut.inode = backup; parent_mut.inode = inode;
parent_mut.user_names = Rc::new(backup.user_names);
parent_mut.group_names = Rc::new(backup.group_names);
} }
Ok(fs) Ok(fs)
} }