Skip to content

Commit

Permalink
implemented opening files on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
wassup05 committed Nov 28, 2024
1 parent bf90f87 commit 9b0cf0b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/internal/handle_panel_movement.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9b0cf0b

Please sign in to comment.