From e8de080addb41424aad72a909f6a470e182d72c1 Mon Sep 17 00:00:00 2001 From: QuantumGhost Date: Thu, 5 Jun 2025 00:47:55 +0800 Subject: [PATCH] fix(api): fix incorrect adjust to Extensible `__file__` records the path of the `Extensible` class, not the receiver class of `scan_extensions` method. This commit fixes this by switching to `inspect.getfile`. --- api/core/extension/extensible.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/core/extension/extensible.py b/api/core/extension/extensible.py index b5737accfe..ac17f4d0b4 100644 --- a/api/core/extension/extensible.py +++ b/api/core/extension/extensible.py @@ -1,5 +1,6 @@ import enum import importlib.util +import inspect import json import logging import os @@ -42,7 +43,7 @@ class Extensible: position_map: dict[str, int] = {} # get the path of the current class - current_path = os.path.abspath(__file__) + current_path = os.path.abspath(inspect.getfile(cls)) current_dir_path = os.path.dirname(current_path) # traverse subdirectories