1 ;------------------------------------------------------------------;
2 ; opus_libre -- 10-score.scm ;
4 ; (c) 2008-2011 Valentin Villenave <valentin@villenave.net> ;
6 ; opus_libre is a free framework for GNU LilyPond: you may ;
7 ; redistribute it and/or modify it under the terms of the GNU ;
8 ; General Public License as published by the Free Software ;
9 ; Foundation, either version 3 of the License, or (at your option) ;
10 ; any later version. ;
11 ; This program is distributed WITHOUT ANY WARRANTY; without ;
12 ; even the implied warranty of MERCHANTABILITY or FITNESS FOR A ;
13 ; PARTICULAR PURPOSE. You should have received a copy of the GNU ;
14 ; General Public License along with this program (typically in the ;
15 ; share/doc/ directory). If not, see http://www.gnu.org/licenses/ ;
17 ;------------------------------------------------------------------;
22 ;; Browsing scores sub-directory
23 (define conf:scores-dir "scores")
24 (define conf:default-score "etc/blank")
26 (define-public (defined-string? sym)
27 "Does SYM refer to a string?"
28 (string? (ly:parser-lookup sym)))
30 ;; This one isn't actually used.
31 (define-public (defined-music? sym)
32 "Does SYM refer to a music expression?"
33 (ly:music? (ly:parser-lookup sym)))
35 (define-public (exists? loc)
36 "Is LOC an accessible file/directory?"
39 (define-public *current-score*
41 ;; "The directory that contains all music variables
42 ;; and local settings, typically located in scores/.
43 ;; Think of it as the usr/ directory in a standard
45 (let* ((defined-score (ly:parser-lookup 'scores))
46 (branch (if (ly:get-option 'git-branch-as-score-name)
47 (let* ((port (open-input-pipe "git branch --no-color | grep \\*"))
48 (str (read-line port)))
50 (set! str (string-drop str 2))
55 (make-path (lambda (f) (string-append conf:scores-dir "/" f))))
56 (if (and branch (not (equal? branch "master")))
57 (if (exists? (make-path branch))
60 (if (exists? (make-path defined-score))
61 (make-path defined-score)
62 (begin (ly:warning "Score directory ~a not found in ~a.
63 A blank score will be created instead." defined-score conf:scores-dir)
65 (begin (ly:warning "Score directory not defined!
66 A blank score will be created instead.")
67 conf:default-score))))))
69 (define-public *current-part* (make-parameter ""))
71 (define-public output-filename "")