From b17266fcb091566aaf2dd8d10028c2085e16c477 Mon Sep 17 00:00:00 2001 From: Gent Semaj Date: Tue, 17 Jun 2025 20:53:44 -0700 Subject: [PATCH] Use file:// protocol on non-Windows platforms --- src-tauri/src/util.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/util.rs b/src-tauri/src/util.rs index ce52fd2..6632724 100644 --- a/src-tauri/src/util.rs +++ b/src-tauri/src/util.rs @@ -162,7 +162,14 @@ pub(crate) fn is_dir_empty(dir: &PathBuf) -> Result { } pub(crate) fn get_path_as_file_uri(path: &Path) -> String { - let uri = format!("file:///{}", path.to_string_lossy()); + let protocol = if cfg!(target_os = "windows") { + "file:///" + } else { + "file://" + }; + + let mut uri = String::from(protocol); + uri.push_str(&path.to_string_lossy()); uri.replace("\\", "/") }