Issue #1204: fix font-name-add-files regtest (issue 573730044 by v.villenave@gmail.com)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue #1204: fix font-name-add-files regtest (issue 573730044 by v.villenave@gmail.com)

David Kastrup

https://codereview.appspot.com/573730044/diff/583810043/input/regression/font-name-add-files.ly
File input/regression/font-name-add-files.ly (right):

https://codereview.appspot.com/573730044/diff/583810043/input/regression/font-name-add-files.ly#newcode25
input/regression/font-name-add-files.ly:25: tmpdir = #(let ((env-tmpdir
(getenv "TMPDIR")))
tmpdir = #(or (getenv "TMPDIR") "/tmp")

https://codereview.appspot.com/573730044/diff/583810043/input/regression/font-name-add-files.ly#newcode28
input/regression/font-name-add-files.ly:28: dummyname = #(port-filename
(mkstemp! (string-append tmpdir "/" "dummyfont-XXXXXX")))
This fixes the problem that mkstemp! needs a writable string since
string-append returns a newly allocated string.  Whether it's by design
or not the computer won't care, so that should fix the potential
Guile-2.x problem.

https://codereview.appspot.com/573730044/diff/583810043/input/regression/font-name-add-files.ly#newcode252
input/regression/font-name-add-files.ly:252: (if (or (equal? "." f)
No point in a functional language to write as if expressions and
procedures were different things.  Just write

(or (equal? "." f) (equal? ".." f)
    (delete-file (string-append ...)))

https://codereview.appspot.com/573730044/

Reply | Threaded
Open this post in threaded view
|

Re: Issue #1204: fix font-name-add-files regtest (issue 573730044 by v.villenave@gmail.com)

v.villenave
Reviewers: dak,

Message:
On 2020/04/20 12:05:15, dak wrote:
>
https://codereview.appspot.com/573730044/diff/583810043/input/regression/font-name-add-files.ly
> File input/regression/font-name-add-files.ly (right):
>
>
https://codereview.appspot.com/573730044/diff/583810043/input/regression/font-name-add-files.ly#newcode25
> input/regression/font-name-add-files.ly:25: tmpdir = #(let
((env-tmpdir (getenv
> "TMPDIR")))
> tmpdir = #(or (getenv "TMPDIR") "/tmp")

Indeed. This should have occurred to me (unlike the similar one below).

>
https://codereview.appspot.com/573730044/diff/583810043/input/regression/font-name-add-files.ly#newcode28
> input/regression/font-name-add-files.ly:28: dummyname =
#(port-filename
> (mkstemp! (string-append tmpdir "/" "dummyfont-XXXXXX")))
> This fixes the problem that mkstemp! needs a writable string since
string-append
> returns a newly allocated string.*

Yes, thus eliminating the need for string-copy and such.

>
https://codereview.appspot.com/573730044/diff/583810043/input/regression/font-name-add-files.ly#newcode252
> input/regression/font-name-add-files.ly:252: (if (or (equal? "." f)
> No point in a functional language to write as if expressions and
procedures were
> different things.  Just write
>
> (or (equal? "." f) (equal? ".." f)
>     (delete-file (string-append ...)))

Heh. I actually lifted that part verbatim from framework-ps.scm. That's
a nice, concise and elegant syntax, it wouldn't have occurred to me.
Thanks!

V.

Description:
Issue #1204: fix font-name-add-files regtest

The temporary directory might not be empty if some
versions of fontconfig add a .uuid file inside it.

Please review this at https://codereview.appspot.com/573730044/

Affected files (+294, -2 lines):
  M Documentation/notation/text.itely
  A input/regression/font-name-add-files.ly