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: normalize extended-length paths for Windows file explorer compatibility

Dexterity1046a9100b07fac
diff --git a/src-tauri/src/core/system/commands.rs b/src-tauri/src/core/system/commands.rs
index 785a70d1c..3d5d38378 100644
--- a/src-tauri/src/core/system/commands.rs
+++ b/src-tauri/src/core/system/commands.rs
@@ -160,8 +160,15 @@ pub fn open_app_directory<R: Runtime>(app: AppHandle<R>) {
pub fn open_file_explorer(path: String) {
let path = PathBuf::from(path);
if cfg!(target_os = "windows") {
+ // Normalize extended-length paths (\\?\...) for explorer compatibility.
+ let mut path_str = path.to_string_lossy().into_owned();
+ if let Some(stripped) = path_str.strip_prefix(r"\\?\UNC\") {
+ path_str = format!(r"\\{}", stripped);
+ } else if let Some(stripped) = path_str.strip_prefix(r"\\?\") {
+ path_str = stripped.to_string();
+ }
std::process::Command::new("explorer")
- .arg(path)
+ .arg(path_str)
.status()
.expect("Failed to open file explorer");
} else if cfg!(target_os = "macos") {
diff --git a/web-app/src/routes/settings/general.tsx b/web-app/src/routes/settings/general.tsx
index c56b5e771..15e499084 100644
--- a/web-app/src/routes/settings/general.tsx
+++ b/web-app/src/routes/settings/general.tsx
@@ -355,7 +355,10 @@ function General() {
onClick={async () => {
if (janDataFolder) {
try {
- const logsPath = `${janDataFolder}/logs`
+ const logsPath = await serviceHub.path().join(
+ janDataFolder,
+ 'logs'
+ )
await serviceHub.opener().revealItemInDir(logsPath)
} catch (error) {
console.error(