Events to the frontend go through App.emit, and a test keeps their names in step with wails.ts. QEMU argument splitting, hidden console processes, the macOS release record, the running check and a few smaller helpers now exist once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
658 B
Go
38 lines
658 B
Go
package qmp
|
|
|
|
import "strings"
|
|
|
|
// SplitArgs splits a QEMU extra-args string and keeps quoted tokens whole.
|
|
func SplitArgs(s string) []string {
|
|
var out []string
|
|
var cur strings.Builder
|
|
var quote byte
|
|
for i := 0; i < len(s); i++ {
|
|
c := s[i]
|
|
if quote != 0 {
|
|
cur.WriteByte(c)
|
|
if c == quote {
|
|
quote = 0
|
|
}
|
|
continue
|
|
}
|
|
if c == '\'' || c == '"' {
|
|
quote = c
|
|
cur.WriteByte(c)
|
|
continue
|
|
}
|
|
if c == ' ' || c == '\t' || c == '\n' || c == '\r' {
|
|
if cur.Len() > 0 {
|
|
out = append(out, cur.String())
|
|
cur.Reset()
|
|
}
|
|
continue
|
|
}
|
|
cur.WriteByte(c)
|
|
}
|
|
if cur.Len() > 0 {
|
|
out = append(out, cur.String())
|
|
}
|
|
return out
|
|
}
|