Repository: Canop/broot (language: rust)

Issue:
actions on new panel broken on windows since 1.30
This was reported by @alexs-n here: https://github.com/Canop/broot/issues/804#issuecomment-1866958386

> i think this fix or at least version 1.30.0 > breaks something on windows @Canop .
the right/ second panel is broken and commands like cpp and mvp wont work.

> the path is not correct

![image](https://github.com/Canop/broot/assets/60710873/605d0aee-a5c0-4949-b6ad-b3d976eced47)




Discussion / hints:
This is obviously related to the canonicalization I added in 1.30, which on Windows changes the path to an UNC path, which isn't compatible with several Windows commands.
As I can't test on Windows, I won't try building my own canonicalization (hint: others could try) but I'll just stop doing it on Windows.

Fix patch:
diff --git a/src/verb/internal_focus.rs b/src/verb/internal_focus.rs
index 0c227f4b..8f2f1291 100644
--- a/src/verb/internal_focus.rs
+++ b/src/verb/internal_focus.rs
@@ -13,7 +13,6 @@ use {
         tree::TreeOptions,
     },
     std::{
-        fs,
         path::{Path, PathBuf},
     },
 };
@@ -53,6 +52,7 @@ pub fn new_state_on_path(
     )
 }
 
+#[allow(unused_mut)]
 pub fn new_panel_on_path(
     mut path: PathBuf,
     screen: Screen,
@@ -61,8 +61,10 @@ pub fn new_panel_on_path(
     con: &AppContext,
     direction: HDir,
 ) -> CmdResult {
+    #[cfg(not(windows))]
     // We try to canonicalize the path, mostly to resolve links
-    if let Ok(canonic) = fs::canonicalize(&path) {
+    // We don't do it on Windows due to issue #809
+    if let Ok(canonic) = std::fs::canonicalize(&path) {
         path = canonic;
         // If it can't be canonicalized, we'll let the panel state
         // deal with the original path


Test patch: