Skip to content

Commit

Permalink
修复报错
Browse files Browse the repository at this point in the history
  • Loading branch information
TC999 committed Dec 6, 2024
1 parent 789d130 commit db5714f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,16 @@ pub fn open_folder(folder_path: &Path) -> Result<(), String> {
};

match status {
Ok(s) if s.success() => Ok(()),
Ok(s) => Err(format!("打开文件夹失败,状态码: {}", s)),
Ok(s) => {
if cfg!(target_os = "windows") {
// Windows 平台,忽略非零退出码
Ok(())
} else if s.success() {
Ok(())
} else {
Err(format!("打开文件夹失败,状态码: {}", s))
}
}
Err(e) => Err(format!("执行打开命令失败: {}", e)),
}
}

0 comments on commit db5714f

Please sign in to comment.