(destDir string)
| 579 | } |
| 580 | |
| 581 | func (p Port) doInstallFromPackage(destDir string) error { |
| 582 | // Check and repair current port. |
| 583 | files, err := p.PackageFiles( |
| 584 | p.PackageDir, |
| 585 | p.ctx.Platform().GetName(), |
| 586 | p.ctx.Project().GetName(), |
| 587 | ) |
| 588 | if err != nil { |
| 589 | return err |
| 590 | } |
| 591 | |
| 592 | // Copy files from package to installed dir. |
| 593 | for _, file := range files { |
| 594 | if p.DevDep || p.HostDep { |
| 595 | file = strings.TrimPrefix(file, p.ctx.Platform().GetHostName()+"-dev"+string(os.PathSeparator)) |
| 596 | } else { |
| 597 | file = strings.TrimPrefix(file, filepath.Join(p.ctx.LibraryFolder(), string(os.PathSeparator))) |
| 598 | } |
| 599 | |
| 600 | src := filepath.Join(p.PackageDir, file) |
| 601 | dest := filepath.Join(destDir, file) |
| 602 | |
| 603 | // Rename meta file as new name in meta folder. |
| 604 | if strings.HasSuffix(file, ".meta") { |
| 605 | dest = p.metaFile |
| 606 | } |
| 607 | |
| 608 | // Ensure dest dir exists. |
| 609 | if err := fileio.MkdirAll(filepath.Dir(dest), os.ModePerm); err != nil { |
| 610 | return err |
| 611 | } |
| 612 | |
| 613 | if err := fileio.CopyFile(src, dest); err != nil { |
| 614 | return fmt.Errorf("failed to copy file.\n%w", err) |
| 615 | } |
| 616 | } |
| 617 | |
| 618 | return nil |
| 619 | } |
| 620 | |
| 621 | func (p *Port) doInstallFromDevCache(options InstallOptions) (bool, error) { |
| 622 | // Try to install dependencies first. |
no test coverage detected