From e87e5e33a77f25d5b587562663589da5e90fa787 Mon Sep 17 00:00:00 2001 From: Mateo Pidal Date: Mon, 13 Jan 2020 21:34:30 -0300 Subject: [PATCH] fix symlink for Termux on Android --- vlib/compiler/main.v | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/vlib/compiler/main.v b/vlib/compiler/main.v index 005db3ad65..3930838585 100644 --- a/vlib/compiler/main.v +++ b/vlib/compiler/main.v @@ -1199,13 +1199,22 @@ pub fn create_symlink() { return } vexe := vexe_path() - link_path := '/usr/local/bin/v' - ret := os.system('ln -sf $vexe $link_path') + mut link_path := '/usr/local/bin/v' + mut ret := os.system('ln -sf $vexe $link_path') if ret == 0 { println('Symlink "$link_path" has been created') } - else { - println('Failed to create symlink "$link_path". Try again with sudo.') + else if os.system('uname -o | grep [A/a]ndroid') == 0 { + println('Failed to create symlink "$link_path". Trying again with Termux path for Android.') + link_path = '/data/data/com.termux/files/usr/bin/v' + ret = os.system('ln -sf $vexe $link_path') + if ret == 0 { + println('Symlink "$link_path" has been created') + } else { + println('Failed to create symlink "$link_path". Try again with sudo.') + } + } else { + println('Failed to create symlink "$link_path". Try again with sudo.') } }