removeFiles remove files and all related shared libraries.
(path string)
| 217 | |
| 218 | // removeFiles remove files and all related shared libraries. |
| 219 | func (p Port) removeFiles(path string) error { |
| 220 | if _, err := os.Stat(path); os.IsNotExist(err) { |
| 221 | return nil |
| 222 | } |
| 223 | |
| 224 | if !strings.Contains(path, "so") { |
| 225 | return os.Remove(path) |
| 226 | } |
| 227 | |
| 228 | before, _, ok := strings.Cut(path, ".so") |
| 229 | if !ok { |
| 230 | return os.Remove(path) |
| 231 | } |
| 232 | |
| 233 | matches, err := filepath.Glob(before + ".so*") |
| 234 | if err != nil { |
| 235 | return err |
| 236 | } |
| 237 | |
| 238 | for _, item := range matches { |
| 239 | if err := os.Remove(item); err != nil { |
| 240 | return err |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | return nil |
| 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()) |