diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-12-06 04:21:28 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-12-06 04:21:28 +0800 |
| commit | 9221e90c81b43b796d8ad8be08b4fa65a55d24de (patch) | |
| tree | d8f3d2c7a76170f78e38015406f44c1e25076721 /src | |
| parent | 5fde983137bdc42d5e164a7ad6f797899ab5ed37 (diff) | |
Support windows
- Simplify PowerShell wrapper function parameter handling
- Change log filename format to use hyphens instead of colons
- Correct Windows drive letter extraction logic to avoid compilation
errors
Diffstat (limited to 'src')
| -rw-r--r-- | src/bin/jvv.rs | 2 | ||||
| -rw-r--r-- | src/utils/globber.rs | 18 |
2 files changed, 8 insertions, 12 deletions
diff --git a/src/bin/jvv.rs b/src/bin/jvv.rs index f40ca97..3e32fa7 100644 --- a/src/bin/jvv.rs +++ b/src/bin/jvv.rs @@ -642,7 +642,7 @@ async fn jvv_service_listen(args: ListenArgs) { return; } let now = chrono::Local::now(); - let log_filename = format!("log_{}.txt", now.format("%Y.%m.%d-%H:%M:%S")); + let log_filename = format!("log_{}.txt", now.format("%Y-%m-%d-%H-%M-%S")); build_env_logger( logs_dir.join(log_filename), vault_cfg.server_config().logger_level(), diff --git a/src/utils/globber.rs b/src/utils/globber.rs index 0c3f471..dbb77ea 100644 --- a/src/utils/globber.rs +++ b/src/utils/globber.rs @@ -246,27 +246,23 @@ pub mod constants { } #[cfg(windows)] { - let current_drive = current_dir() - .unwrap_or_default() + let current_drive = current_dir .components() .find_map(|comp| { - if let std::path::Component::Prefix(prefix) = comp { - Some(prefix) + if let std::path::Component::Prefix(prefix_component) = comp { + Some(prefix_component) } else { None } }) - .and_then(|prefix| { - if let std::path::Prefix::Disk(drive_letter) - | std::path::Prefix::VerbatimDisk(drive_letter) = prefix - { + .and_then(|prefix_component| match prefix_component.kind() { + std::path::Prefix::Disk(drive_letter) + | std::path::Prefix::VerbatimDisk(drive_letter) => { Some((drive_letter as char).to_string()) - } else { - None } + _ => None, }) .unwrap_or_else(|| "C".to_string()); - ( PathBuf::from(format!("{}:{}", current_drive, ROOT_DIR_PREFIX)), remaining.to_string(), |
