From fb6a807a37eb385b031daa58926b1966352c0d2a Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sun, 17 Nov 2024 18:21:49 +0000 Subject: [PATCH] Desktop: Trying to fix issue with permission errors when installing a plugin --- packages/lib/services/plugins/PluginService.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/lib/services/plugins/PluginService.ts b/packages/lib/services/plugins/PluginService.ts index a2a103e32af..1b9338279a7 100644 --- a/packages/lib/services/plugins/PluginService.ts +++ b/packages/lib/services/plugins/PluginService.ts @@ -584,7 +584,17 @@ export default class PluginService extends BaseService { // from where it is now to check that it is valid and to retrieve // the plugin ID. const preloadedPlugin = await this.loadPluginFromPath(jplPath); - await this.deletePluginFiles(preloadedPlugin); + try { + await this.deletePluginFiles(preloadedPlugin); + } catch (error) { + // Deleting the plugin appears to occasionally fail on Windows (maybe because the files + // are still loaded?), and it prevents the plugin from being installed. Because of this + // we just ignore the error - it means that there will be unnecessary files in the cache + // directory, which is not a big issue. + // + // Ref: https://discourse.joplinapp.org/t/math-mode-plugin-no-longer-works-in-windows-v3-1-23/41853 + logger.warn('Could not delete plugin temp directory:', error); + } // On mobile, it's necessary to create the plugin directory before we can copy // into it.