From 739f3cd90b6241969923e6875915bb101a94cd20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Pei=C3=9Fl?= Date: Sat, 9 Jul 2022 16:23:19 +0200 Subject: [PATCH] pref: detect termux more reliably (#15001) --- vlib/v/pref/os.v | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/vlib/v/pref/os.v b/vlib/v/pref/os.v index 81ff56418c..e874d04196 100644 --- a/vlib/v/pref/os.v +++ b/vlib/v/pref/os.v @@ -3,6 +3,8 @@ // that can be found in the LICENSE file. module pref +import os + pub enum OS { _auto // Reserved so .macos cannot be misunderstood as auto ios @@ -91,13 +93,13 @@ pub fn (o OS) str() string { } pub fn get_host_os() OS { + if os.getenv('TERMUX_VERSION') != '' { + return .termux + } + $if android { + return .android + } $if linux { - $if android { - $if termux { - return .termux - } - return .android - } return .linux } $if ios {