Oracle插件绝对路径改相对路径
This commit is contained in:
1 parent
eb17ca8bc2
commit
cd3d31bf11
2 files changed
+13
-4
No files matched your search
+1
-1
@@ -69,4 +69,4 @@ PLM_ORACLE_PORT=1521
|
||||
PLM_ORACLE_SID=orcl
|
||||
PLM_ORACLE_USERNAME=PLM
|
||||
PLM_ORACLE_PASSWORD=PLM
|
||||
ORACLE_CLIENT_LIB_DIR=C:\Users\PC\Desktop\HX工作目录\0509\hxops\backend\oracle_client\instantclient_19_30
|
||||
ORACLE_CLIENT_LIB_DIR=oracle_client\instantclient_19_30
|
||||
@@ -16,12 +16,19 @@ class Text2SQLService:
|
||||
def _project_root(cls) -> str:
|
||||
return os.path.dirname(cls._backend_dir())
|
||||
|
||||
@classmethod
|
||||
def _resolve_project_path(cls, path_value: str) -> str:
|
||||
normalized = os.path.normpath(path_value)
|
||||
if os.path.isabs(normalized):
|
||||
return normalized
|
||||
return os.path.normpath(os.path.join(cls._project_root(), normalized))
|
||||
|
||||
@classmethod
|
||||
def _find_oracle_client_dir(cls) -> str | None:
|
||||
env_dir = (os.getenv("ORACLE_CLIENT_LIB_DIR") or "").strip()
|
||||
candidate_roots = []
|
||||
if env_dir:
|
||||
candidate_roots.append(env_dir)
|
||||
candidate_roots.append(cls._resolve_project_path(env_dir))
|
||||
candidate_roots.extend([
|
||||
os.path.join(cls._backend_dir(), 'oracle_client'),
|
||||
os.path.join(cls._project_root(), 'oracle_client'),
|
||||
@@ -152,8 +159,10 @@ class Text2SQLService:
|
||||
@classmethod
|
||||
def _get_oracle_client_dir(cls) -> str | None:
|
||||
env_dir = (os.getenv("ORACLE_CLIENT_LIB_DIR") or "").strip()
|
||||
if env_dir and os.path.exists(env_dir):
|
||||
return env_dir
|
||||
if env_dir:
|
||||
resolved_env_dir = cls._resolve_project_path(env_dir)
|
||||
if os.path.exists(resolved_env_dir):
|
||||
return resolved_env_dir
|
||||
|
||||
linux_candidates = [
|
||||
"/opt/oracle/instantclient",
|
||||
|
||||
Reference in new issue
Block a user