Ellerbach / docfx-companion-tools

A suite of tools, pipelines templates to take the very best of DocFX
MIT License
66 stars 18 forks source link

Items in the order file are no longer case sensitive #4

Closed sacrejohn closed 2 years ago

sacrejohn commented 2 years ago

I propose that items in the order file are no longer case sensitive because I name my readme files: Readme.md.

There is an automatic system that allows the readme file to be in the first position, however in the code we add README. This does not allow me to take advantage of this feature.

// we always want to order README.md. So add it if not in list yet
string readmeEntry = order.FirstOrDefault(x => string.Equals("README", x, StringComparison.OrdinalIgnoreCase));
if (string.IsNullOrEmpty(readmeEntry))
{
    order.Add("README");
    message.Verbose($"'README' added to order-list");
}
Ellerbach commented 2 years ago

First, totally sorry for the delay, totally missed your PR!

Linux, MacOs and Windows (with NTFS) are all case sensitive OS when it comes to files. So I would prefer to have it case sensitive. Now debate is open. And I would suguest to use linq in a different way, so rather then Contains, that would work as well:

order.Where(x => string.Compare(x, Path.GetFileNameWithoutExtension(fi.Name), StringComparison.InvariantCultureIgnoreCase)==0);

For the order with the readme, you always want to have the README first?

sacrejohn commented 2 years ago

I didn't know that some OS are case sensitive. I understand better your choice.

Thanks