On Tue, Aug 2, 2011 at 8:57 AM, Andrei Alexandrescu <seewebsiteforem...@erdani.org> wrote: > On 08/02/2011 01:02 AM, Jonathan M Davis wrote: >> >> Actually, I suppose that I could sum up my take on it by saying that if >> the >> two aren't absolutely identical, they shouldn't be treated as equal. >> >> "file." and "file" do _not_ have the same extension. One has an empty >> extension >> whereas the other has none. > > I agree. A simple solution is to make the dot part of the extension. So > extension("file.") returns "." and extension("file") returns the empty > string (be it null or not). Problem solved. > > One nice side effect is that concatenating the base and the extension gives > back the name. >
For what it is worth. This also matches how std.log deals with extensions. Well, std.log leaves it up to the user to include the period ('.'). /++ Specifies the extension for the name of log files. The default value is $(D ".log"). +/ @property string fileNameExtension(string extension) { return _fileNameExtension = extension; }