From e6e55d31dbc5e1e4402774a057fefee64180dcfd Mon Sep 17 00:00:00 2001 From: ityuany <519495771@qq.com> Date: Tue, 16 Apr 2024 22:53:44 +0800 Subject: [PATCH] bugfix --- crates/cli/src/main.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index cf4f4ddf..1bbc9795 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -25,6 +25,7 @@ use snm_pnpm::snm_pnpm::SnmPnpm; use snm_yarn::{snm_yarn::SnmYarn, snm_yarnpkg::SnmYarnPkg}; use std::{ fs, + ops::Not, process::{Command, Stdio}, }; mod manage_command; @@ -98,11 +99,13 @@ async fn execute_cli() -> Result<(), SnmError> { let output_string = String::from_utf8(output).unwrap(); if let Some(home) = dirs::home_dir() { - let spec_path_buf = home - .join(".fig") - .join("autocomplete") - .join("build") - .join("snm.ts"); + let dir = home.join(".fig").join("autocomplete").join("build"); + + if dir.exists().not() { + fs::create_dir_all(&dir)?; + } + + let spec_path_buf = dir.join("snm.ts"); if spec_path_buf.exists() { fs::remove_file(&spec_path_buf)?;