Create dir every time
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 58s

This commit is contained in:
Alexandre Bruyant 2024-01-07 19:51:18 +01:00
parent 6b4eec8251
commit d9623d5615

18
main.go
View File

@ -114,21 +114,20 @@ func main() {
defer mwriter.Close() defer mwriter.Close()
defer writer.Close() defer writer.Close()
w, err := mwriter.CreateIpfsDirectoryPart(path)
if err != nil {
githubactions.Fatalf("Unable to create root dir path: %v", fmt.Errorf("%w", err))
}
err = filepath.Walk(path, func(innerPath string, info fs.FileInfo, err error) error { err = filepath.Walk(path, func(innerPath string, info fs.FileInfo, err error) error {
if err != nil { if err != nil {
return err return err
} }
if info.IsDir() { relPath, _ := filepath.Rel(path, innerPath)
return nil
}
w, err = mwriter.CreateIpfsFilePart(innerPath) if info.IsDir() {
_, err = mwriter.CreateIpfsDirectoryPart(relPath)
if err != nil {
return err
}
} else {
w, err := mwriter.CreateIpfsFilePart(relPath)
if err != nil { if err != nil {
return err return err
} }
@ -143,6 +142,7 @@ func main() {
if err != nil { if err != nil {
return fmt.Errorf("error copying %s (%d bytes written): %v", innerPath, written, err) return fmt.Errorf("error copying %s (%d bytes written): %v", innerPath, written, err)
} }
}
return nil return nil
}) })