Skip to content

Commit 382ed7c

Browse files
committed
修复目录错误
1 parent 5ee9d95 commit 382ed7c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,16 @@ fn validate_args(args: &args::Cli) -> Result<()> {
9999
if args.api.is_none() {
100100
return Err(anyhow!("使用 --file 或 --dir 时,必须提供 --api 参数。"));
101101
}
102-
if let Some(file) = &args.file {
103-
if !Path::new(file).exists() {
104-
return Err(anyhow!("文件不存在: {:?}", file));
105-
}
106-
}
107102
if let Some(file) = &args.file
108103
&& !Path::new(file).exists()
109104
{
110105
return Err(anyhow!("文件不存在: {:?}", file));
111106
}
107+
if let Some(dir) = &args.dir
108+
&& !Path::new(dir).is_dir()
109+
{
110+
return Err(anyhow!("目录不存在: {:?}", dir));
111+
}
112112
}
113113

114114
Ok(())

0 commit comments

Comments
 (0)