Nitpick: ly:spanner-bound grob name slur -> spanner.
[lilypond.git] / scm / kpathsea.scm
blob5b655f6cb6115b1a4b1a553af044ecd82c15dc65
1 ;;
2 ;; kpathsea.scm -- implement kpath support using command-line
3 ;; 
4 ;;
5 ;; source file of the GNU LilyPond music typesetter
6 ;;
7 ;; (c) 2005--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
8 ;;
10 (define-module (scm kpathsea))
12 (use-modules (ice-9 popen)
13              (lily)
14              (ice-9 rdelim))
18 (define-public (ly:kpathsea-find-file name)
19   (let*
20       ((cmd  (format #f "kpsewhich ~a"
21                      (sanitize-command-option name)))
22        (unused (if (ly:get-option 'verbose)
23                    (ly:message "Running ~a" cmd)))
24        (pipe (open-input-pipe cmd))
25        (answer (read-line pipe)))
27     (if (string? answer)
28         answer
29         #f)))
30                             
31 (define-public (ly:kpathsea-expand-variable var)
32   (let*
33       ((cmd (format #f "kpsexpand '$'~a"
34                     (sanitize-command-option var)))
35        (unused (if (ly:get-option 'verbose)
36                    (ly:message "Running ~a" cmd)))
37        (pipe (open-input-pipe cmd))
38        (answer (read-line pipe)))
40     (if (string? answer)
41         answer #f)))
43 ;; Test:
45 ;;(display (ly:kpathsea-find-file "cmr10.tfm"))
47 ;;(display (ly:kpathsea-expand-variable "TEXMF"))