Skip to content

Commit

Permalink
Merge pull request #496 from wassup05/windows-open
Browse files Browse the repository at this point in the history
fix: opening files on windows
  • Loading branch information
yorukot authored Nov 29, 2024
2 parents bf90f87 + 9b0cf0b commit b6eaebb
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 b6eaebb

Please sign in to comment.