mirror of
https://github.com/vbatts/go-mtree.git
synced 2025-07-27 00:30:27 +00:00
walk: directory is expected to be walked. A file is not.
Fixes: #166 Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
b9356e6843
commit
5d7f6c36e0
2 changed files with 27 additions and 0 deletions
5
walk.go
5
walk.go
|
@ -33,6 +33,11 @@ func Walk(root string, excludes []ExcludeFunc, keywords []Keyword, fsEval FsEval
|
|||
if fsEval == nil {
|
||||
fsEval = DefaultFsEval{}
|
||||
}
|
||||
if info, err := os.Stat(root); err == nil {
|
||||
if !info.IsDir() {
|
||||
return nil, fmt.Errorf("%s: Not a directory", filepath.Base(root))
|
||||
}
|
||||
}
|
||||
creator := dhCreator{DH: &DirectoryHierarchy{}, fs: fsEval}
|
||||
// insert signature and metadata comments first (user, machine, tree, date)
|
||||
for _, e := range signatureEntries(root) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue