launcher ".desktop" handling: preserve existing Exec=
content
This commit is contained in:
parent
89b89f91a3
commit
b431d8fea1
|
@ -117,11 +117,15 @@ the following additional associations apply to launchers:
|
||||||
|
|
||||||
@item{@racket['desktop] (Unix) --- a string containing the content of
|
@item{@racket['desktop] (Unix) --- a string containing the content of
|
||||||
a @filepath{.desktop} file for the launcher, where @tt{Exec}
|
a @filepath{.desktop} file for the launcher, where @tt{Exec}
|
||||||
and @tt{Icon} items should be omitted, because they will be
|
and @tt{Icon} entries are added automatically. If an @tt{Exec}
|
||||||
added automatically. The file is written to the directory
|
entry exists in the string, and if its value starts with a
|
||||||
produced by @racket[(find-apps-dir)] or
|
non-empty sequence of alpha-numeric ASCII characters followed
|
||||||
@racket[(find-user-apps-dir)]. A @racket['desktop] value is
|
by a space, then the space and remainder of the value is
|
||||||
used only when @racket['install-mode] is also specified.}
|
appended to the automatically generated value.
|
||||||
|
The @filepath{.desktop} file is written to the directory produced by
|
||||||
|
@racket[(find-apps-dir)] or @racket[(find-user-apps-dir)]. A
|
||||||
|
@racket['desktop] value is used only when
|
||||||
|
@racket['install-mode] is also specified.}
|
||||||
|
|
||||||
@item{@racket['png] (Unix) : An icon file path (suffix
|
@item{@racket['png] (Unix) : An icon file path (suffix
|
||||||
@filepath{.png}) to be referenced by a @filepath{.desktop}
|
@filepath{.png}) to be referenced by a @filepath{.desktop}
|
||||||
|
|
|
@ -539,8 +539,20 @@
|
||||||
file
|
file
|
||||||
#:exists 'truncate
|
#:exists 'truncate
|
||||||
(lambda (o)
|
(lambda (o)
|
||||||
(displayln (regexp-replace #rx"\n+$" (cdr m) "") o)
|
(define content (cdr m))
|
||||||
(fprintf o "Exec=~a\n" (adjust-path dest))
|
(displayln (regexp-replace #rx"\n+$"
|
||||||
|
(regexp-replace "(?m:^Exec=.*)\n*"
|
||||||
|
content
|
||||||
|
"")
|
||||||
|
"")
|
||||||
|
o)
|
||||||
|
(fprintf o "Exec=~a~a\n"
|
||||||
|
(adjust-path dest)
|
||||||
|
;; Keep rest of existing line, if any:
|
||||||
|
(let ([m (regexp-match "(?m:^Exec=[a-zA-Z0-9]+( .*))" content)])
|
||||||
|
(if m
|
||||||
|
(cadr m)
|
||||||
|
"")))
|
||||||
(let ([m (or (assq 'png aux)
|
(let ([m (or (assq 'png aux)
|
||||||
(assq 'ico aux))])
|
(assq 'ico aux))])
|
||||||
(when m
|
(when m
|
||||||
|
|
Loading…
Reference in New Issue
Block a user