ldoc icon indicating copy to clipboard operation
ldoc copied to clipboard

Filename case issues for cross-platform document generation

Open steve-baker-cradle opened this issue 2 years ago • 5 comments

It seems LDoc behaves differently on macOS & Windows with respect to resolving file references.

As an example, my config.ld file contains two files:

topics = { 'Info.md' }
file = { 'app.lua' }

(Note: Info.md has a capital letter at the start.)

app.lua contains the following reference:

--  This should always be @{Info.md|some info}.

When generating the documentation on macOS this works as expected, but the Windows generation produces a module not found warning and the output contains '???' instead of a valid link.

I believe the different arises because the filenames are passed through pl.path.normcase in LDoc's tools.abspath function and converted to lower case on Windows which causes the name mismatch.

Converting the reference only to lower case (@{info.md|some info}) resolves the issue on Windows but then makes it incompatible with macOS where no case conversion takes place, so the only way to make both platforms work is to only use filenames with lower case letters.

Is this expected behaviour?

steve-baker-cradle avatar Jan 26 '23 17:01 steve-baker-cradle