Skip to content

Commit b6a01e5

Browse files
committed
fix: keybinding cmd split error
keybinding cmd split error Log:
1 parent 6649ed7 commit b6a01e5

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

keybinding/manager.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
package keybinding
66

77
import (
8+
"fmt"
89
"os"
910
"os/exec"
10-
"path"
1111
"path/filepath"
1212
"strings"
1313
"time"
@@ -1139,7 +1139,14 @@ func (m *Manager) execCmd(cmd string, viaStartdde bool) error {
11391139

11401140
if m.useNewAppManager {
11411141
desktopExt := ".desktop"
1142-
name := strings.TrimSuffix(filepath.Base(cmd), path.Ext(cmd))
1142+
splitStr := strings.Split(cmd, " ")
1143+
if len(splitStr) == 0 {
1144+
err := fmt.Errorf("invalid command: %s", splitStr)
1145+
return err
1146+
}
1147+
1148+
name := splitStr[len(splitStr)-1]
1149+
11431150
desktopFileName := "daemon-keybinding-" + name + desktopExt
11441151

11451152
_, err := os.Stat(basedir.GetUserDataDir() + "/applications/" + desktopFileName)

0 commit comments

Comments
 (0)