From 6272ca74bc6ba1ba0c11bbbc12d5d01f17128de3 Mon Sep 17 00:00:00 2001 From: negative0 Date: Mon, 25 Jan 2021 23:11:52 +0530 Subject: [PATCH] plugins: Move plugins cache path initialization to initPluginsOrError. Fixes #4951. --- fs/rc/webgui/plugins.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/rc/webgui/plugins.go b/fs/rc/webgui/plugins.go index 3ebc0ede5..67205f033 100644 --- a/fs/rc/webgui/plugins.go +++ b/fs/rc/webgui/plugins.go @@ -68,13 +68,6 @@ var ( initMutex = &sync.Mutex{} ) -func init() { - cachePath = filepath.Join(config.CacheDir, "webgui") - PluginsPath = filepath.Join(cachePath, "plugins") - pluginsConfigPath = filepath.Join(PluginsPath, "config") - -} - // Plugins represents the structure how plugins are saved onto disk type Plugins struct { mutex sync.Mutex @@ -96,6 +89,9 @@ func initPluginsOrError() error { initMutex.Lock() defer initMutex.Unlock() if !initSuccess { + cachePath = filepath.Join(config.CacheDir, "webgui") + PluginsPath = filepath.Join(cachePath, "plugins") + pluginsConfigPath = filepath.Join(PluginsPath, "config") loadedPlugins = newPlugins(availablePluginsJSONPath) err := loadedPlugins.readFromFile() if err != nil {