Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix(engine): match verbatim \\?\ preset paths in the orphan sweep (#9156)

thinhlpgd2f5df4020ae
diff --git a/src-tauri/src/core/system/orphans.rs b/src-tauri/src/core/system/orphans.rs
index 57917beb5..c55591898 100644
--- a/src-tauri/src/core/system/orphans.rs
+++ b/src-tauri/src/core/system/orphans.rs
@@ -48,7 +48,17 @@ pub struct ProcInfo {
}
fn normalize(path: &str) -> String {
- path.replace('\\', "/").to_ascii_lowercase()
+ let path = path.replace('\\', "/").to_ascii_lowercase();
+ // `\\?\C:\...` and `\\?\UNC\server\share\...` name the same file as their plain
+ // form. 0.8.4 passes its preset path in the verbatim form, so without this
+ // the sweep never recognises the engine it exists to reap.
+ if let Some(rest) = path.strip_prefix("//?/unc/") {
+ format!("//{rest}")
+ } else if let Some(rest) = path.strip_prefix("//?/") {
+ rest.to_string()
+ } else {
+ path
+ }
}
fn is_router_binary(name: &str) -> bool {