2016-03-16 19:59:34 +00:00
|
|
|
package mtree
|
|
|
|
|
2016-04-12 20:49:52 +00:00
|
|
|
// Check a root directory path against the DirectoryHierarchy, regarding only
|
|
|
|
// the available keywords from the list and each entry in the hierarchy.
|
|
|
|
// If keywords is nil, the check all present in the DirectoryHierarchy
|
2016-10-31 10:42:53 +00:00
|
|
|
//
|
|
|
|
// This is equivalent to creating a new DirectoryHierarchy with Walk(root, nil,
|
2016-11-18 07:53:26 +00:00
|
|
|
// keywords, fs) and then doing a Compare(dh, newDh, keywords).
|
|
|
|
func Check(root string, dh *DirectoryHierarchy, keywords []Keyword, fs FsEval) ([]InodeDelta, error) {
|
2016-10-31 10:42:53 +00:00
|
|
|
if keywords == nil {
|
2016-12-14 05:24:02 +00:00
|
|
|
keywords = dh.UsedKeywords()
|
2016-03-18 20:31:12 +00:00
|
|
|
}
|
|
|
|
|
2016-11-18 07:53:26 +00:00
|
|
|
newDh, err := Walk(root, nil, keywords, fs)
|
2016-10-31 10:42:53 +00:00
|
|
|
if err != nil {
|
2016-03-18 20:31:12 +00:00
|
|
|
return nil, err
|
|
|
|
}
|
2016-12-14 05:24:02 +00:00
|
|
|
|
2016-10-31 10:42:53 +00:00
|
|
|
return Compare(dh, newDh, keywords)
|
2016-03-16 19:59:34 +00:00
|
|
|
}
|