MCPcopy Create free account
hub / github.com/celer-pkg/celer / removeFiles

Method removeFiles

configs/port_remove.go:219–245  ·  view source on GitHub ↗

removeFiles remove files and all related shared libraries.

(path string)

Source from the content-addressed store, hash-verified

217
218// removeFiles remove files and all related shared libraries.
219func (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
247func (p Port) RemoveLogs() error {
248 libraryDir := fmt.Sprintf("%s-%s-%s", p.ctx.Platform().GetName(), p.ctx.Project().GetName(), p.ctx.BuildType())

Callers 1

doRemovePortMethod · 0.95

Calls 1

RemoveMethod · 0.45

Tested by

no test coverage detected