Skip to content

Commit

Permalink
Use Rel
Browse files Browse the repository at this point in the history
  • Loading branch information
mcantelon committed Jan 20, 2025
1 parent 7628d79 commit 8383cc1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/activities/validate_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"os"
"path/filepath"
"slices"
"strings"

"github.com/artefactual-sdps/preprocessing-sfa/internal/enums"
"github.com/artefactual-sdps/preprocessing-sfa/internal/fsutil"
Expand Down Expand Up @@ -45,8 +44,10 @@ func (a *ValidateStructure) Execute(
}

if path != params.SIP.Path {
// Assemble relative path.
relativePath := strings.Replace(path, params.SIP.Path+"/", "", 1)
relativePath, err := filepath.Rel(params.SIP.Path, path)
if err != nil {
return err
}

// Initialize this directory's total number of immediate children.
if d.IsDir() {
Expand All @@ -66,7 +67,7 @@ func (a *ValidateStructure) Execute(
// Report any empty subdirectories.
for path, children := range paths {
if children == 0 {
failures = append(failures, fmt.Sprintf("SIP subdirectory '%s' is empty", path))
failures = append(failures, fmt.Sprintf("SIP subdirectory %q is empty", path))
}
}

Expand Down

0 comments on commit 8383cc1

Please sign in to comment.