On 4/24/21 8:47 PM
lifeatt...@gmail.com wrote:
> I've run into two issues with fl_filename_ext(). Using the latest github
> FLTK and Linux.
>
> First, the documentation says the function returns NULL if there is no
> "last period". In fact, I've found the function returns the empty string
> in that case:
>
> out = fl_filename_ext("/some/path/foo/");
> assert(out != 0);
> assert(strlen(out) == 0);
> out = fl_filename_ext("/some/path/foo");
> assert(out != 0);
> assert(strlen(out) == 0);
>
> This appears to be day-zero behavior, so a minor tweak to the
> documentation should be all that is required.
I agree, if this is indeed day-zero behavior, then the docs could be
fixed, but OTOH returning NULL seems more appropriate (to me).
> Second, how is a hidden file/folder expected to be handled? E.g.
>
> out = fl_filename_ext("/some/path/foo/.hidden");
>
> will return the string ".hidden", whereas I consider the path to not
> have an extension.
>
> Any thoughts?
First of all, what is a "hidden" file, or, a better question would be:
"on which platform(s) is a filename or directory-name beginning with '.'
considered a hidden file?
I know it's a Unix convention, but what about Windows? I don't think
it's a general convention on Windows because Windows has its own
"hidden" file attribute. OTOH, if you're using a POSIX shell like MinGW,
MSYS, etc. then the Unix convention would be valid. However, FLTK is not
a shell, so which convention should be used?
I don't have clear answers to all these questions.
Second, I agree that the Unix convention as described by Bill would be
good to use *if* we changed the code.