mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-29 13:41:51 +02:00
fix: preserve drive letter in Windows plugin paths (#410)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,6 @@ log = { workspace = true }
|
||||
md5 = "0.7.0"
|
||||
path-slash = "0.2.1"
|
||||
rand = "0.9.0"
|
||||
regex = "1.10.6"
|
||||
reqwest = { workspace = true, features = ["json"] }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true }
|
||||
|
||||
@@ -1081,16 +1081,10 @@ async fn read_plugins_dir(dir: &PathBuf) -> Result<Vec<String>> {
|
||||
fn fix_windows_paths(p: &PathBuf) -> String {
|
||||
use dunce;
|
||||
use path_slash::PathBufExt;
|
||||
use regex::Regex;
|
||||
|
||||
// 1. Remove UNC prefix for Windows paths to pass to sidecar
|
||||
let safe_path = dunce::simplified(p.as_path()).to_string_lossy().to_string();
|
||||
// 1. Remove UNC prefix for Windows paths
|
||||
let safe_path = dunce::simplified(p.as_path());
|
||||
|
||||
// 2. Remove the drive letter
|
||||
let safe_path = Regex::new("^[a-zA-Z]:").unwrap().replace(safe_path.as_str(), "");
|
||||
|
||||
// 3. Convert backslashes to forward
|
||||
let safe_path = PathBuf::from(safe_path.to_string()).to_slash_lossy().to_string();
|
||||
|
||||
safe_path
|
||||
// 2. Convert backslashes to forward slashes for Node.js compatibility
|
||||
PathBuf::from(safe_path).to_slash_lossy().to_string()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user