Hello Gilles,

thank you very much.
Your solutions do work, but I don't think I'll use them in my project.

But you have unintentionally pushed me in the right direction (with the "emptyfile.ly" thing).
What I'll do now is:

- create empty replacement files 01.ily through 90.ily in an arbitrary folder
- add this folder to LilyPond's include path
- simply use \include "19.ily"

When that file isn't present in the current folder Lily will simply use the replacement one :-)

Thanks again

Best
Urs

Am 08.09.2014 23:14, schrieb Gilles THIBAULT:
I found out that using
#(ly:parser-parse-string (ly:parser-clone parser) "\\include \"01.ily\"")
_does_ actually work, but not when the included file contains variable
definitions (e.g. "music = ...").
Still no ideas?

Perhaps something like that :


%%%%%%%%%%

\version "2.18.2"

file = #(let((myfile "test.ly"))
(if (file-exists? myfile)
        myfile
        "emptyfile.ly"))

\include #file

%%%%%%%%%

which seems to works, but you need to create an empty file "emptyfile.ly"
somewhere in your PATH.
Alternatively, this seems also to work :

...
(if (file-exists? myfile)
        myfile
        ""))

but you will get an advertisement for the \include ""




_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to