Skip to content

Commit

Permalink
fix: no file or dir
Browse files Browse the repository at this point in the history
  • Loading branch information
sjfhsjfh committed Mar 1, 2025
1 parent 0bf2f66 commit 986cd74
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/commands/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{fs, path::Path};
use anyhow::{bail, Result};
use clap::{Arg, Command};
use dialoguer::Confirm;
use log::warn;
use log::{debug, warn};

use crate::utils::{read_manifest, typst_local_dir, walkers::walker_install};

Expand Down Expand Up @@ -85,7 +85,11 @@ pub fn install(src_dir: &Path, target: &str) -> Result<()> {
if let Ok(entry) = entry {
let path = entry.path();
let dest = version_dir.join(path.strip_prefix(src_dir).unwrap());
debug!("Copying {:?} to {:?}", path, dest);
if path.is_file() {
if let Some(parent) = dest.parent() {
fs::create_dir_all(parent)?;
}
fs::copy(&path, &dest)?;
} else if path.is_dir() {
fs::create_dir_all(&dest)?;
Expand Down

0 comments on commit 986cd74

Please sign in to comment.