Closed suiso67 closed 1 month ago
Thank you! It's perfect and respects the way the plugin is written. However, I should take some time to modify the make function and replace the shellescape()
command with a simple %q
in string.format
, like for example:
string.format('lilypond %s %s -f %s -o %q %s', C.backend, C.include, C.output_fm, Utils.joinpath(folder, name), C.main)
I wasn't aware of this possibility when I created this function...
I took a closer look, and your solution causes an issue for files whose names contain a space because the filename is already escaped.
I think the error comes from here:
local C = Config.fileInfos()
local folder = vim.fn.expand(C.folder)
The value of C.folder
is already in the correct format, and it's the vim.fn.expand
function that removes the escaped values.
This should be good :
local folder = C.folder
You're right, I didn't notice that. IMHO it would be nice to know whether a path or file name is escaped or not by reading it's name. Like adding _path
to the end of escaped/safe path string, such as C.folder_path
.
Anyway, sorry for the oversight, and thank you for the quick patch. Now I can keep transcribing.
I noticed that if I run
compile lilypond
command when:.ly
file is under a path containing whitespace(let's say/foo/bar baz/main.ly
)lilypond.options.include_dir
with some value, then the compiled pdf/midi files are saved under
/foo/bar
(/foo/bar/main.pdf
,/foo/bar/main.midi
), not under/foo/bar baz
I'm not really familiar with
lilypond
command so I don't know why it doesn't have the same problem when I don't setlilypond.options.include_dir
, but nonetheless the path should be escaped.