(passive bool)
| 474 | } |
| 475 | |
| 476 | func (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 | |
| 515 | func (app *app) handleIncomingURL(url string) { |
| 516 | // wait for a space |
no test coverage detected