A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.
Rust archive-managerdesktop-appdual-paneexplorer-alternativefile-browserfile-explorerfile-managerfluent-designgpu-acceleratedgpuimacosmicaproductivityquick-lookrustrust-guitabswindowswindows-11windows-explorer
Windows Search results open on a Windows in another language (1100)
gelenmedyaa17b3ae98467
diff --git a/crates/rf-win/src/wsearch.rs b/crates/rf-win/src/wsearch.rsindex ab28b824..4505001e 100644--- a/crates/rf-win/src/wsearch.rs+++ b/crates/rf-win/src/wsearch.rs@@ -50,7 +50,7 @@ pub fn is_indexed(root: &Path) -> bool {fn sql_for(root: &Path, query: &str, max: usize) -> anyhow::Result<String> {unsafe {let helper: ISearchQueryHelper = manager()?.GetCatalog(w!("SystemIndex"))?.GetQueryHelper()?;- helper.SetQuerySelectColumns(w!("System.ItemPathDisplay,System.Size,System.DateModified,System.DateCreated,System.FileAttributes"))?;+ helper.SetQuerySelectColumns(w!("System.ItemUrl,System.Size,System.DateModified,System.DateCreated,System.FileAttributes"))?;let scope = root.to_string_lossy().replace('\'', "''");let restrict = wide(format!("AND SCOPE='file:{scope}'"));helper.SetQueryWhereRestrictions(PCWSTR(restrict.as_ptr()))?;@@ -97,13 +97,31 @@ fn rd<T: Copy>(buf: &[u8], off: usize) -> T {unsafe { std::ptr::read_unaligned(buf.as_ptr().add(off) as *const T) }}+/// The file's real path from the index's `System.ItemUrl` (`file:C:/Users/me/Masaüstü/a.txt`, `file://server/share/a.txt`).+///+/// WHY (issue 1100: an OneDrive file found by search did not open, "C:\Usuarios\..." on a Portuguese Windows).+/// The column read before, `System.ItemPathDisplay`, is the path as Explorer DISPLAYS it: its folder names are the shown ones,+/// so on any Windows not in English a result could not be opened. Seen on this PC too: "C:\Users\ozero\Desktop\..." for+/// a file in `Masaüstü` (2026-12-05); the item URL had the real name. Pure.+fn path_of_item_url(url: &str) -> Option<PathBuf> {+ let rest = url.strip_prefix("file:")?;+ let path = if let Some(local) = rest.strip_prefix("///") {+ local.replace('/', "\\")+ } else if let Some(unc) = rest.strip_prefix("//") {+ format!(r"\\{}", unc.replace('/', "\\"))+ } else {+ rest.replace('/', "\\")+ };+ (!path.is_empty()).then(|| PathBuf::from(path))+}+fn parse_row(buf: &[u8]) -> Option<SearchHit> {if rd::<u32>(buf, OFF_PATH_ST) != DBSTATUS_S_OK.0 as u32 {return None;}let bytes = rd::<usize>(buf, OFF_PATH_LEN).min(PATH_CHARS * 2 - 2);let units: Vec<u16> = (0..bytes / 2).map(|i| rd::<u16>(buf, OFF_PATH + i * 2)).collect();- let path = PathBuf::from(String::from_utf16_lossy(&units));+ let path = path_of_item_url(&String::from_utf16_lossy(&units))?;let ok = |st: usize| rd::<u32>(buf, st) == DBSTATUS_S_OK.0 as u32;let ft = |off: usize, st: usize| if ok(st) { rd::<u64>(buf, off) } else { 0 };let attrs = if ok(OFF_ATTR_ST) { rd::<u32>(buf, OFF_ATTR) } else { 0x20 };@@ -192,6 +210,29 @@ pub fn search(mod tests {use super::*;+ /// Issue 1100: the index's item URL gives the real path, local or on a share, with its letters as they are.+ #[test]+ fn an_item_url_is_turned_into_the_real_path() {+ assert_eq!(path_of_item_url("file:C:/Users/ozero/Masaüstü/a b.txt"), Some(PathBuf::from(r"C:\Users\ozero\Masaüstü\a b.txt")));+ assert_eq!(path_of_item_url("file:///C:/Users/x.txt"), Some(PathBuf::from(r"C:\Users\x.txt")));+ assert_eq!(path_of_item_url("file://nas/share/x.txt"), Some(PathBuf::from(r"\\nas\share\x.txt")));+ assert_eq!(path_of_item_url("mapi://something"), None);+ assert_eq!(path_of_item_url("file:"), None);+ }++ /// The real search on this PC finds files whose paths exist: the display path ("Desktop" for "Masaüstü") would not.+ #[test]+ #[ignore = "asks this PC's Windows Search index"]+ fn found_files_exist() {+ let root = PathBuf::from(std::env::var("USERPROFILE").unwrap());+ let mut all = Vec::new();+ search(&root, "*.txt", 30, &|| false, &mut |b| all.extend(b)).unwrap();+ assert!(!all.is_empty());+ for h in &all {+ assert!(h.path.exists(), "{}", h.path.display());+ }+ }+/// Manual: `cargo test -p rf-win wsearch_live -- --ignored --nocapture` (RF_Q=query)#[test]#[ignore]