(sourceRoot, targetRoot string)
| 585 | } |
| 586 | |
| 587 | func copyLocalDirContents(sourceRoot, targetRoot string) error { |
| 588 | return filepath.Walk(sourceRoot, func(sourcePath string, info os.FileInfo, err error) error { |
| 589 | if err != nil { |
| 590 | return err |
| 591 | } |
| 592 | if sourcePath == sourceRoot { |
| 593 | return nil |
| 594 | } |
| 595 | if info.Mode()&os.ModeSymlink != 0 || (!info.IsDir() && !info.Mode().IsRegular()) { |
| 596 | return fmt.Errorf("unsupported skill package entry: %s", sourcePath) |
| 597 | } |
| 598 | rel, err := filepath.Rel(sourceRoot, sourcePath) |
| 599 | if err != nil { |
| 600 | return err |
| 601 | } |
| 602 | name, err := safeLocalSkillZipEntryName(rel) |
| 603 | if err != nil { |
| 604 | return err |
| 605 | } |
| 606 | targetPath := filepath.Join(targetRoot, name) |
| 607 | if info.IsDir() { |
| 608 | return os.MkdirAll(targetPath, info.Mode()) |
| 609 | } |
| 610 | return copyLocalSkillFile(sourcePath, targetPath) |
| 611 | }) |
| 612 | } |
| 613 | |
| 614 | func copyLocalSkillFile(source, target string) error { |
| 615 | src, err := os.Open(source) |
no test coverage detected