Skip to content

Commit

Permalink
Fix adding directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxerwang committed May 18, 2024
1 parent fb4a951 commit 63cc5a0
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions hashcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ func fillFileInfo(contentFiles []*FileEntry) ([]*FileEntry, error) {
return nil, err
}

if fi.IsDir() {
for _, d := range pdirs.parse(f.DebPath) {
de := &FileEntry{
Path: "",
DebPath: d,
FileInfo: NewDirFileInfo(d),
}

newDirs = append(newDirs, de)
for _, d := range pdirs.parse(f.DebPath) {
de := &FileEntry{
Path: "",
DebPath: d,
FileInfo: NewDirFileInfo(d),
}

newDirs = append(newDirs, de)
}

if fi.IsDir() {
err := filepath.Walk(f.Path, func(path string, info os.FileInfo, err error) error {
if info.IsDir() {
relpath, err := filepath.Rel(f.Path, path)
Expand All @@ -110,8 +110,9 @@ func fillFileInfo(contentFiles []*FileEntry) ([]*FileEntry, error) {
FileInfo: info,
}

newDirs = append(newDirs, de)

if _, ok := pdirs.cache[de.DebPath]; !ok {
newDirs = append(newDirs, de)
}
return nil
}

Expand Down

0 comments on commit 63cc5a0

Please sign in to comment.