MCPcopy
hub / github.com/matryer/xbar / clearCache

Method clearCache

app/app.go:476–513  ·  view source on GitHub ↗
(passive bool)

Source from the content-addressed store, hash-verified

474}
475
476func (app *app) clearCache(passive bool) {
477 // bit cheeky - but use the oslock in PluginsService to protect
478 // against this from being run concurrently.
479 app.PluginsService.osLock.Lock()
480 defer app.PluginsService.osLock.Unlock()
481 err := os.RemoveAll(cacheDirectory)
482 if err != nil {
483 if passive {
484 return
485 }
486 _, err2 := app.runtime.Dialog.Message(&dialog.MessageDialog{
487 Type: dialog.ErrorDialog,
488 Title: "Clear cache failed",
489 Message: err.Error(),
490 Buttons: []string{"OK"},
491 CancelButton: "OK",
492 })
493 if err2 != nil {
494 log.Println(err2)
495 return
496 }
497 return
498 }
499 if passive {
500 return
501 }
502 _, err2 := app.runtime.Dialog.Message(&dialog.MessageDialog{
503 Type: dialog.InfoDialog,
504 Title: "Cache cleared",
505 Message: "The local cache was successfully cleared.",
506 Buttons: []string{"OK"},
507 CancelButton: "OK",
508 })
509 if err2 != nil {
510 log.Println(err2)
511 return
512 }
513}
514
515func (app *app) handleIncomingURL(url string) {
516 // wait for a space

Callers 3

ClearCacheMethod · 0.80

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected