Added Flatpak-specific Python module search paths in plugin init: when FLATPAK_ID is present, the loader now also probes /app/lib/zoitechat/python and /app/lib/x86_64-linux-gnu/zoitechat/python before importing zoitechat.

Kept the existing safe behavior intact: paths are only added if they exist and are not already in sys.path, so this broadens compatibility without duplicating entries.
This commit is contained in:
2026-02-22 11:42:49 -07:00
parent 76796f5f23
commit d379bb138c

View File

@@ -550,6 +550,12 @@ def _on_plugin_init(plugin_name, plugin_desc, plugin_version, arg, libdir):
os.path.join(appdir, 'usr', 'lib', 'x86_64-linux-gnu', 'zoitechat', 'python'), os.path.join(appdir, 'usr', 'lib', 'x86_64-linux-gnu', 'zoitechat', 'python'),
]) ])
if os.getenv('FLATPAK_ID'):
modpaths.extend([
'/app/lib/zoitechat/python',
'/app/lib/x86_64-linux-gnu/zoitechat/python',
])
for modpath in modpaths: for modpath in modpaths:
if os.path.isdir(modpath) and modpath not in sys.path: if os.path.isdir(modpath) and modpath not in sys.path:
sys.path.append(modpath) sys.path.append(modpath)