First time post

Below the signature is a short, I dare not call it tiny, lilypond input file demonstrating an issue with (file-exists? and the use of --include=DIRECTORY on the command line.

Is there a list or string that I can access from a lilypond script that contains the entire search path, including any additions from the -include=DIRECTORY?

-- Regards, Rob D.
=============Short Example ======================================================== \version "2.25.19" % % The void-function below will include file named in string 'file' % using the (parser-include-string ...). % % If the named file is present as tested by (file-exists? file) % % Command Line: % E6410% lilypond --include=RealBookClone fileExistExample.ly % % The issue is the use of --include= directives on the command line. % When the search path is exapanded on the command line % (file-exists? file) does not appear to traverse the expanded include path. % % Adding a loop over the path to the void-function includeIfExists (below) % would allow (file-exist? file) be placed within that loop. % includeIfExists = #(define-void-function (file)(string?) (if (file-exists? file) (begin (ly:message (ly:format "file-exists #t \"~A\"\n" file)) (ly:parser-include-string (ly:format "\\include \"~A\"\n" file))) (ly:message (ly:format "file-exists #f \"~A\"\n" file)))) % % Assume the file "LilyJAZZ.ily" may or may not exist in a % separate directory % defined by --include=RealBookClone % \includeIfExists "LilyJAZZ.ily" % % It is possible to hardcode the path but that makes the idea % of adding to a search path from the command line superfluous. \includeIfExists "RealBookClone/LilyJAZZ.ily" % % Uncomment the two lines below to demonstrate % parser-include-string can find a file in the search path %(ly:parser-include-string % (ly:format "\\include \"~A\"\n" "LilyJAZZ.ily")) % % Uncomment the two lines below to demonstrate % parser-include-string the error the new function % (void-function includeIfExists seeks to avoid %(ly:parser-include-string % (ly:format "\\include \"~A\"\n" "NonexistantFile.ily"))


Reply via email to