From bc5b3caa85f7a8d4597f51aeaf92b83162ed6b33 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sun, 29 Sep 2024 16:09:37 +0000 Subject: [PATCH] analyzer: move const used to download install.vsh script (#127) --- src/up.v | 4 ---- src/utils.v | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/up.v b/src/up.v index 87662ea..55343ac 100644 --- a/src/up.v +++ b/src/up.v @@ -2,10 +2,6 @@ module main import cli import term -import os - -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-analyzer', 'install.vsh') fn up_cmd(cmd cli.Command) ! { download_install_vsh()! diff --git a/src/utils.v b/src/utils.v index 8e03a43..fc0ae46 100644 --- a/src/utils.v +++ b/src/utils.v @@ -4,6 +4,10 @@ import os import term import net.http +const download_dir = os.join_path(os.vtmp_dir(), 'v-analyzer') +const analyzer_install_script_download_path = 'https://raw.githubusercontent.com/vlang/v-analyzer/main/install.vsh' +const analyzer_install_script_path = os.join_path(download_dir, 'install.vsh') + pub fn errorln(msg string) { eprintln('${term.red('[ERROR]')} ${msg}') } @@ -21,7 +25,6 @@ pub fn successln(msg string) { } pub fn download_install_vsh() ! { - download_dir := os.join_path(os.vtmp_dir(), 'v-analyzer') if !os.exists(download_dir) { os.mkdir(download_dir) or { return error('Failed to create tmp dir: ${err}') } }