Skip to content

Commit fb89def

Browse files
committed
fix: windows mpv
Signed-off-by: ygelfand <yuri@shlitz.com>
1 parent da8d551 commit fb89def

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

internal/tui/player/manager.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"path/filepath"
1010
"runtime"
1111
"sync"
12+
"syscall"
1213
"time"
1314

1415
"github.com/LukeHagar/plexgo/models/operations"
@@ -260,6 +261,17 @@ func (pm *PlayerManager) ensureMpv() error {
260261

261262
func (pm *PlayerManager) socketExists() bool {
262263
if runtime.GOOS == "windows" {
264+
_, err := os.OpenFile(pm.socketPath, os.O_RDWR, 0)
265+
if err != nil {
266+
if pe, ok := err.(*os.PathError); ok {
267+
if errno, ok := pe.Err.(syscall.Errno); ok {
268+
if errno == 2 {
269+
return false
270+
}
271+
}
272+
}
273+
return true
274+
}
263275
return true // Named pipes are harder to stat, let dialing handle it
264276
}
265277
_, err := os.Stat(pm.socketPath)

0 commit comments

Comments
 (0)