From 4e0d2653916cfa0eb8d0d23bf96d0ea5f66725f3 Mon Sep 17 00:00:00 2001 From: ityuany <519495771@qq.com> Date: Sun, 14 Jul 2024 00:56:14 +0800 Subject: [PATCH] add anchor_mark --- crates/snm_shim/src/lib.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/snm_shim/src/lib.rs b/crates/snm_shim/src/lib.rs index 39e0f104..608c929b 100644 --- a/crates/snm_shim/src/lib.rs +++ b/crates/snm_shim/src/lib.rs @@ -9,11 +9,23 @@ use snm_package_manager::snm_package_manager::SnmPackageManager; use snm_utils::{exec::exec_cli, snm_error::SnmError}; use std::env::{self, current_dir}; +fn anchor_mark() -> Result<(), SnmError> { + match env::var("SNM_ANCHOR") { + Ok(_) => return Err(SnmError::NotFoundValidVersion), + Err(_) => { + env::set_var("SNM_ANCHOR", "true"); + } + } + Ok(()) +} + pub async fn load_package_manage_shim(prefix: &str, bin_name: &str) -> Result<(), SnmError> { env_logger::init(); let args_all: Vec = env::args().collect(); + anchor_mark()?; + let command = &args_all[1]; let args: Vec = std::env::args().skip(1).collect(); @@ -76,6 +88,8 @@ pub async fn load_package_manage_shim(prefix: &str, bin_name: &str) -> Result<() pub async fn get_node_bin_dir() -> Result { let dir = current_dir()?; + anchor_mark()?; + let snm_config = parse_snm_config(&dir)?; let snm_node: &dyn AtomTrait = &SnmNode::new(snm_config.clone());