From 9b0cf0be89a0cc62bc16922522433b4e8491e3ec Mon Sep 17 00:00:00 2001 From: Suprit S Jahagirdar Date: Thu, 28 Nov 2024 10:04:04 +0530 Subject: [PATCH] implemented opening files on windows --- src/internal/handle_panel_movement.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/internal/handle_panel_movement.go b/src/internal/handle_panel_movement.go index 4803bbf..677d0d3 100644 --- a/src/internal/handle_panel_movement.go +++ b/src/internal/handle_panel_movement.go @@ -96,7 +96,20 @@ func (m *model) enterPanel() { openCommand := "xdg-open" if runtime.GOOS == "darwin" { openCommand = "open" + } else if runtime.GOOS == "windows" { + + dllpath := filepath.Join(os.Getenv("SYSTEMROOT"), "System32", "rundll32.exe") + dllfile := "url.dll,FileProtocolHandler" + + cmd := exec.Command(dllpath, dllfile, panel.element[panel.cursor].location) + err = cmd.Start() + if err != nil { + outPutLog(fmt.Sprintf("err when open file with %s", openCommand), err) + } + + return } + cmd := exec.Command(openCommand, panel.element[panel.cursor].location) err = cmd.Start() if err != nil {