FLTK logo

Re: [fltk.general] Concerns regarding fl_filename_ext()

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Concerns regarding fl_filename_ext() Albrecht Schlosser Apr 25, 2021  
 
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.

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/3fcb6c3a-7fe5-2439-19c4-8da6c9f52896%40online.de.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.