gregorio-project / gregorio

The Gregorio Project
http://gregorio-project.github.io
Other
155 stars 43 forks source link

Recursive gregpath search #1571

Open rpspringuel opened 1 year ago

rpspringuel commented 1 year ago

Right now we use the same mechanism as the graphics package to add additional directories for GregorioTeX to search for gabc files (See gregoriotex-main.tex lines 1938-1943). While this is relatively straightforward code, it doesn't allow you to look in subdirectories of the added directories.

I.e. given music/antiphons/The_Lord_our_King.gabc exists relative to the main document, the following won't work

\gresetgregpath{{music/}}
\gregorioscore{antiphons/The_Lord_our_King.gabc}

Though this does:

\gresetgregpath{{music/antiphons/}}
\gregorioscore{The_Lord_our_King.gabc}

I propose that we switch to the mechanism used by lyluatex for specifying and searching additional paths (i.e. having Lua do it instead of TeX). See lyluatex.lua lines 106-121 and 145-160.

rpspringuel commented 8 months ago

The problem here isn't one of not being able to look in subdirectories, as it turns out. After a careful inspection of the log I discovered that the first does find the gabc file. What causes the problem is the attempt to remove old gtex files because antiphons doesn't exist relative to the current working directory, it exists relative to the gregpath. While there are multiple possible fixes for this, the simplest seems to be to finish #1543, as forcing the gtex files into a temporary directory that we create means we always know were to find them.