2016-03-16 15:59:34 -04:00
|
|
|
package mtree
|
|
|
|
|
2016-04-12 16:49:52 -04: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 21:42:53 +11:00
|
|
|
//
|
|
|
|
// This is equivalent to creating a new DirectoryHierarchy with Walk(root, nil,
|
2016-11-18 18:53:26 +11: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 21:42:53 +11:00
|
|
|
if keywords == nil {
|
2016-12-14 16:24:02 +11:00
|
|
|
keywords = dh.UsedKeywords()
|
2016-03-18 16:31:12 -04:00
|
|
|
}
|
|
|
|
|
2016-11-18 18:53:26 +11:00
|
|
|
newDh, err := Walk(root, nil, keywords, fs)
|
2016-10-31 21:42:53 +11:00
|
|
|
if err != nil {
|
2016-03-18 16:31:12 -04:00
|
|
|
return nil, err
|
|
|
|
}
|
2016-12-14 16:24:02 +11:00
|
|
|
|
2016-10-31 21:42:53 +11:00
|
|
|
return Compare(dh, newDh, keywords)
|
2016-03-16 15:59:34 -04:00
|
|
|
}
|