1
0
Fork 0

Handle case when there's no actions in .desktop file

master
dump_stack() 2020-01-09 23:07:32 +00:00
parent 1f4214199e
commit 1fbbdee76a
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
1 changed files with 5 additions and 1 deletions

View File

@ -32,7 +32,11 @@ func (r *ddf) OnAdd(ctx context.Context) {
log.Fatal(err)
}
b = bytes.ReplaceAll(b, []byte("Actions="), []byte("Actions=appvm;"))
if bytes.Contains(b, []byte("Actions=")) {
b = bytes.ReplaceAll(b, []byte("Actions="), []byte("Actions=appvm;"))
} else {
b = bytes.ReplaceAll(b, []byte("Exec="), []byte("Actions=appvm;\nExec="))
}
raw := string(regexp.MustCompile("Exec=[a-zA-Z0-9]*").Find(b))