From db17f95ce81909985d72d35caafe0402ed56efed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 10 Jan 2023 21:11:44 +0800 Subject: [PATCH] TerminalShell: detect Termux version --- src/detection/terminalshell/terminalshell.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index 3a80ce153..0b68dfbe0 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -158,6 +158,16 @@ bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version) bool fftsGetTerminalVersion(FFstrbuf* processName, FF_UNUSED_PARAM FFstrbuf* exe, FFstrbuf* version) { + #ifdef __ANDROID__ + + if(ffStrbufEqualS(processName, "Termux")) + { + ffStrbufSetS(version, getenv("TERMUX_VERSION")); + return true; + } + + #endif + const char* termProgramVersion = getenv("TERM_PROGRAM_VERSION"); if(termProgramVersion) { @@ -177,7 +187,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_UNUSED_PARAM FFstrbuf* exe return getFileVersion(exe->chars, version); - #endif + #else return false; + + #endif }