Allow filtering absolute paths

Before, the restorer called the filter function with a relative path,
this prevented anchoring absolute patterns (which just never matched).
Now call the restore function with an absolute virtual path, starting at
the filepath separator.

Closes 
This commit is contained in:
Alexander Neumann 2017-03-02 14:50:54 +01:00
parent 4f5e9e939b
commit bf97cc7efa

View file

@ -120,7 +120,7 @@ func (res *Restorer) restoreNodeTo(node *Node, dir string, dst string, idx *Hard
// Before an item is created, res.Filter is called. // Before an item is created, res.Filter is called.
func (res *Restorer) RestoreTo(dir string) error { func (res *Restorer) RestoreTo(dir string) error {
idx := NewHardlinkIndex() idx := NewHardlinkIndex()
return res.restoreTo(dir, "", *res.sn.Tree, idx) return res.restoreTo(dir, string(filepath.Separator), *res.sn.Tree, idx)
} }
// Snapshot returns the snapshot this restorer is configured to use. // Snapshot returns the snapshot this restorer is configured to use.