Create dir every time
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 58s
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 58s
This commit is contained in:
parent
6b4eec8251
commit
d9623d5615
40
main.go
40
main.go
@ -114,34 +114,34 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
relPath, _ := filepath.Rel(path, innerPath)
|
||||||
|
|
||||||
if info.IsDir() {
|
if info.IsDir() {
|
||||||
return nil
|
_, err = mwriter.CreateIpfsDirectoryPart(relPath)
|
||||||
}
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
w, err := mwriter.CreateIpfsFilePart(relPath)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
w, err = mwriter.CreateIpfsFilePart(innerPath)
|
fileReader, err := os.Open(innerPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer fileReader.Close()
|
||||||
|
|
||||||
fileReader, err := os.Open(innerPath)
|
written, err := io.Copy(w, fileReader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("error copying %s (%d bytes written): %v", innerPath, written, err)
|
||||||
}
|
}
|
||||||
defer fileReader.Close()
|
|
||||||
|
|
||||||
written, err := io.Copy(w, fileReader)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("error copying %s (%d bytes written): %v", innerPath, written, err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user