Stuff!
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
use crate::Opt;
|
||||
use crate::Config;
|
||||
use async_recursion::async_recursion;
|
||||
use futures::future::join_all;
|
||||
use std::io::{self, ErrorKind};
|
||||
@ -6,14 +6,14 @@ use std::path::PathBuf;
|
||||
use tokio::fs::{create_dir, read_dir, remove_file, symlink};
|
||||
use tokio::try_join;
|
||||
|
||||
pub async fn link_tree(opt: &Opt) -> io::Result<()> {
|
||||
dir(opt, PathBuf::new()).await
|
||||
pub async fn link_tree(cfg: &Config) -> io::Result<()> {
|
||||
dir(cfg, PathBuf::new()).await
|
||||
}
|
||||
|
||||
#[async_recursion]
|
||||
async fn dir(opt: &Opt, relative: PathBuf) -> io::Result<()> {
|
||||
let build_path = opt.build_dir.join(&relative);
|
||||
let link_path = opt.link_dir.join(&relative);
|
||||
async fn dir(cfg: &Config, relative: PathBuf) -> io::Result<()> {
|
||||
let build_path = cfg.build_dir.join(&relative);
|
||||
let link_path = cfg.link_dir.join(&relative);
|
||||
|
||||
info!("traversing {:?}", build_path);
|
||||
|
||||
@ -33,9 +33,9 @@ async fn dir(opt: &Opt, relative: PathBuf) -> io::Result<()> {
|
||||
let new_relative = relative.join(entry.file_name());
|
||||
|
||||
if meta.is_dir() {
|
||||
dir_tasks.push(dir(opt, new_relative));
|
||||
dir_tasks.push(dir(cfg, new_relative));
|
||||
} else if meta.is_file() {
|
||||
file_tasks.push(file(opt, new_relative));
|
||||
file_tasks.push(file(cfg, new_relative));
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,9 +58,9 @@ async fn dir(opt: &Opt, relative: PathBuf) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn file(opt: &Opt, relative: PathBuf) -> io::Result<()> {
|
||||
let build_path = opt.build_dir.join(&relative);
|
||||
let link_path = opt.link_dir.join(&relative);
|
||||
async fn file(cfg: &Config, relative: PathBuf) -> io::Result<()> {
|
||||
let build_path = cfg.build_dir.join(&relative);
|
||||
let link_path = cfg.link_dir.join(&relative);
|
||||
|
||||
match remove_file(&link_path).await {
|
||||
Ok(_) => {
|
||||
|
||||
Reference in New Issue
Block a user