There are a number of issues regarding how .pat file paths are resolved under Linux, affecting libmodplug/src/load_pat.cpp:
Since TiMidity works fine in the same environment, a partial imitation of the .pat file resolution logic in it would probably be the best way to go. Here it is for reference:
a) Every path in a 'dir' directive is appended to a list. A 'dir' directive can have multiple paths separated by spaces.
b) The .pat file name is passed to open_file verbatim. If that fails, AND the file name does not end in .pat already, then the string .pat is appended, and open_file is tried again. (It also considers files ending in .pat.gz and similar, and decompresses them, but I think that's out of the scope of libmodplug).
c) open_file works as follows:
- If the .pat name is an absolute path, then it's used as is, and reports success of failure.
- Otherwise, every path in the path list (see a) is prepended to the file name and tried in turn.
A closer look into TiMidity's .cfg parser reveals that it recognizes paths enclosed in single or double quotes ('...' or "...") as single paths regardless of whether they contain spaces. That should probably be imitated as well.