From 7cf79989b6503f12f6803c5e197d68b182ddfa23 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Thu, 19 Sep 2024 12:46:07 +0200 Subject: [PATCH] analyzer: create vtmp directory for check-updates/up commands Signed-off-by: Laurent Cheylus --- src/check-updates.v | 5 +++++ src/up.v | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/check-updates.v b/src/check-updates.v index 43acbe16..920d8a92 100644 --- a/src/check-updates.v +++ b/src/check-updates.v @@ -1,8 +1,13 @@ module main import cli +import os fn check_updates_cmd(_ cli.Command) ! { + if !os.exists(analyzer_dir) { + os.mkdir(analyzer_dir)! + } + download_install_vsh()! call_install_vsh('check-updates')! } diff --git a/src/up.v b/src/up.v index f9b6e855..fbeaf0b9 100644 --- a/src/up.v +++ b/src/up.v @@ -4,10 +4,15 @@ import cli import term import os +pub const analyzer_dir = os.join_path(os.vtmp_dir(), 'v-analyzer') pub const analyzer_install_script_download_path = 'https://raw.githubusercontent.com/vlang/v-analyzer/main/install.vsh' -pub const analyzer_install_script_path = os.join_path(os.vtmp_dir(), 'v-analzyer', 'install.vsh') +pub const analyzer_install_script_path = os.join_path(analyzer_dir, 'install.vsh') fn up_cmd(cmd cli.Command) ! { + if !os.exists(analyzer_dir) { + os.mkdir(analyzer_dir)! + } + download_install_vsh()! is_nightly := cmd.flags.get_bool('nightly') or { false }