更新自动打开文件夹功能
Some checks failed
Release / Publish to Github Releases (, macos-latest, aarch64-apple-darwin, true) (push) Has been cancelled
Release / Publish to Github Releases (, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
Release / Publish to Github Releases (, ubuntu-latest, aarch64-unknown-linux-musl, true) (push) Has been cancelled
Release / Publish to Github Releases (, ubuntu-latest, arm-unknown-linux-musleabihf, true) (push) Has been cancelled
Release / Publish to Github Releases (, ubuntu-latest, armv7-unknown-linux-musleabihf, true) (push) Has been cancelled
Release / Publish to Github Releases (, ubuntu-latest, i686-unknown-linux-musl, true) (push) Has been cancelled
Release / Publish to Github Releases (, ubuntu-latest, x86_64-unknown-linux-musl, true) (push) Has been cancelled
Release / Publish to Github Releases (, windows-latest, aarch64-pc-windows-msvc, true) (push) Has been cancelled
Release / Publish to Github Releases (, windows-latest, i686-pc-windows-msvc, true) (push) Has been cancelled
Release / Publish to Github Releases (, windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
Release / Publish to crates.io (push) Has been cancelled

This commit is contained in:
Lkhsss
2025-03-15 17:09:57 +08:00
parent 9d4c7d57b8
commit a6f37a961c
7 changed files with 57 additions and 5 deletions

View File

@ -19,4 +19,8 @@ pub struct Cli {
/// 强制覆盖保存开关
#[arg(short, long, name = "强制覆盖开关")]
pub forcesave: bool,
/// 自动打开输出目录
#[arg(short,long,name="自动打开输出目录")]
pub autoopen:bool,
}

View File

@ -19,6 +19,7 @@ mod ncmdump;
mod pathparse;
mod test;
mod threadpool;
mod opendir;
use ncmdump::Ncmfile;
const DEFAULT_MAXWORKER:usize = 8;
@ -118,7 +119,14 @@ fn main() {
successful.to_string().bright_green(),
(taskcount - successful).to_string().bright_red(),
showtime()
)
);
// 自动打开输出文件夹
if cli.autoopen{
opendir::opendir(outputdir.into());
};
}
lazy_static! {

34
src/opendir.rs Normal file
View File

@ -0,0 +1,34 @@
use log::error;
use std::{path::PathBuf, process::Command};
#[cfg(target_os = "windows")]
pub fn opendir(dir: PathBuf) {
match Command::new("explorer")
.arg(&dir) // <- Specify the directory you'd like to open.
.spawn()
{
Err(_) => error!("无法打开输出文件夹:[{}]", dir.display()),
_ => (),
}
}
#[cfg(target_os = "linux")]
pub fn opendir(dir: PathBuf) {
match Command::new("open")
.arg(&dir) // <- Specify the directory you'd like to open.
.spawn()
{
Err(_) => error!("无法打开输出文件夹:[{}]", dir.display()),
_ => (),
}
}
#[cfg(target_os = "macos")]
pub fn opendir(dir: PathBuf) {
match Command::new("open")
.arg(&dir) // <- Specify the directory you'd like to open.
.spawn()
{
Err(_) => error!("无法打开输出文件夹:[{}]", dir.display()),
_ => (),
}
}