PoolDirectory returns directory in package pool of published repository for this package files
()
| 712 | |
| 713 | // PoolDirectory returns directory in package pool of published repository for this package files |
| 714 | func (p *Package) PoolDirectory() (string, error) { |
| 715 | source := p.Source |
| 716 | if source == "" { |
| 717 | source = p.Name |
| 718 | } else if pos := strings.Index(source, "("); pos != -1 { |
| 719 | source = strings.TrimSpace(source[:pos]) |
| 720 | } |
| 721 | |
| 722 | if len(source) < 2 { |
| 723 | return "", fmt.Errorf("package source %s too short", source) |
| 724 | } |
| 725 | |
| 726 | var subdir string |
| 727 | if strings.HasPrefix(source, "lib") { |
| 728 | subdir = source[:4] |
| 729 | } else { |
| 730 | subdir = source[:1] |
| 731 | |
| 732 | } |
| 733 | |
| 734 | return filepath.Join(subdir, source), nil |
| 735 | } |
| 736 | |
| 737 | // PackageDownloadTask is a element of download queue for the package |
| 738 | type PackageDownloadTask struct { |