From b0032b3ebc0eb302c0a1bfdbb5dd12e773eac040 Mon Sep 17 00:00:00 2001 From: hsorby Date: Mon, 3 May 2021 21:12:15 +1200 Subject: [PATCH] Get the correct location of the inbuilt plugins directory. --- src/mapclient/core/managers/pluginmanager.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mapclient/core/managers/pluginmanager.py b/src/mapclient/core/managers/pluginmanager.py index 146af639..dcac224a 100644 --- a/src/mapclient/core/managers/pluginmanager.py +++ b/src/mapclient/core/managers/pluginmanager.py @@ -18,7 +18,7 @@ from pkgutil import extend_path import pkg_resources -from mapclient.core.utils import which, FileTypeObject, grep +from mapclient.core.utils import which, FileTypeObject, grep, is_frozen from mapclient.settings.definitions import VIRTUAL_ENV_PATH, \ PLUGINS_PACKAGE_NAME, PLUGINS_PTH from mapclient.core.checks import getPipExecutable, getActivateScript @@ -175,8 +175,11 @@ def setLoadDefaultPlugins(self, loadDefaultPlugins): def allDirectories(self): plugin_dirs = self._directories[:] if self._load_default_plugins: - file_dir = os.path.dirname(os.path.abspath(__file__)) - inbuilt_plugin_dir = os.path.realpath(os.path.join(file_dir, '..', '..', 'plugins')) + if is_frozen(): + inbuilt_plugin_dir = os.path.join(sys._MEIPASS, PLUGINS_PACKAGE_NAME) + else: + file_dir = os.path.dirname(os.path.abspath(__file__)) + inbuilt_plugin_dir = os.path.realpath(os.path.join(file_dir, '..', '..', PLUGINS_PACKAGE_NAME)) plugin_dirs.insert(0, inbuilt_plugin_dir) return plugin_dirs