From 05101c98eff3db896caa7a9ea6aed17091e0c766 Mon Sep 17 00:00:00 2001 From: mrbeanc Date: Thu, 21 Dec 2023 15:18:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3get=5Ftracked=5Ffiles(?= =?UTF-8?q?)=EF=BC=8C=E4=B8=8D=E9=9C=80=E8=A6=81=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8=E4=BA=8E?= =?UTF-8?q?=E7=A3=81=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/index.rs | 8 +------- src/utils/util.rs | 5 ++++- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/models/index.rs b/src/models/index.rs index 8209d32..5ada61a 100644 --- a/src/models/index.rs +++ b/src/models/index.rs @@ -168,13 +168,7 @@ impl Index { /** 获取跟踪的文件列表 */ pub fn get_tracked_files(&self) -> Vec { - let mut files = Vec::new(); - self.entries.keys().for_each(|file| { - if file.exists() { //todo: cancel this check - files.push(file.clone()); - } - }); - files + self.entries.keys().map(|f| f.clone()).collect() } } diff --git a/src/utils/util.rs b/src/utils/util.rs index f8c3a07..82d6e41 100644 --- a/src/utils/util.rs +++ b/src/utils/util.rs @@ -1,4 +1,3 @@ -use chrono::format::format; use sha1::{Digest, Sha1}; use std::io::Write; use std::path::{Path, PathBuf}; @@ -170,6 +169,10 @@ pub fn to_root_relative_path(path: &Path) -> PathBuf { //todo: rename get_relative_path(path, &get_working_dir().unwrap()) } +pub fn to_workdir_absolute_path(path: &Path) -> PathBuf { + get_working_dir().unwrap().join(path) +} + fn is_executable(path: &str) -> bool { #[cfg(not(target_os = "windows"))] {