Repository: Canop/broot (language: rust)

Issue:
When creating a new pane under Windows, the path contains garbage
![image](https://github.com/Canop/broot/assets/4342746/4eb300a7-3980-49d4-afc8-2a9745bb1fba)

This happens with `panel_right`. This syntax looks like some code might be trying to referring to the device ID of the disk, but failing.

This bug was not present earlier this year. Subsequent operations in broot DO fail because the garbled path gets passed to powershell, rmdir, xcopy, etc.


Discussion / hints:
I thought I fixed this with broot 1.30.2. Can you check you have the last version ?
BTW it's not really garbage but what's called UNC paths: https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#unc-paths
You're right, it is fixed!
Sorry, I compile broot locally and I had 1.30.2 on my desktop but not my laptop
A variant of this bug appears to have been reintroduced in version 1.39.1.
Last known working version 1.38.0
1.39.0 untested

However all paths are UNC now, not just new panes.
Oh, thanks for noticing. I know where this comes from. I'll make a PR and request your test (I can't test on Windows).

Fix patch:
diff --git a/src/browser/browser_state.rs b/src/browser/browser_state.rs
index 69d98350..276da47f 100644
--- a/src/browser/browser_state.rs
+++ b/src/browser/browser_state.rs
@@ -53,7 +53,13 @@ impl BrowserState {
         con: &AppContext,
         dam: &Dam,
     ) -> Result<BrowserState, TreeBuildError> {
+
+        // on windows, canonicalize the path produces UNC paths, so we don't do it.
+        // On other platforms, it's a desirable step, mainly because it simplifies the
+        // paths you'd get for example when focusing a relative symlink containing "..".
+        #[cfg(not(target_os = "windows"))]
         let path = path.canonicalize().unwrap_or(path);
+
         let pending_task = options.pattern
             .take()
             .as_option()


Test patch: