| 245 | } |
| 246 | |
| 247 | func (p Port) RemoveLogs() error { |
| 248 | libraryDir := fmt.Sprintf("%s-%s-%s", p.ctx.Platform().GetName(), p.ctx.Project().GetName(), p.ctx.BuildType()) |
| 249 | logPathPrefix := filepath.Join(p.NameVersion(), expr.If(p.DevDep || p.HostDep, p.ctx.Platform().GetHostName()+"-dev", libraryDir)) |
| 250 | matches, err := filepath.Glob(filepath.Join(dirs.BuildtreesDir, logPathPrefix+"-*.log")) |
| 251 | if err != nil { |
| 252 | return fmt.Errorf("glob syntax error -> %w", err) |
| 253 | } |
| 254 | |
| 255 | for _, match := range matches { |
| 256 | if err := os.Remove(match); err != nil { |
| 257 | return fmt.Errorf("failed to remove log %s -> %w", match, err) |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | return nil |
| 262 | } |