Boost logo

Boost :

Subject: Re: [boost] [filesystem] Decomposition of filenames beginning with period?
From: Jorge Lodos Vigil (lodos_at_[hidden])
Date: 2011-04-07 12:10:01


Beman Dawes wrote:

>Boost.Filesystem class path views filenames as being made up of a stem
>and an extension.
>
>My Windows Users directory includes files ".gitconfig" and ".netrc".
>
>The current class path implementation views these as having extensions
>of ".gitconfig" and ".netrc", respectively, and empty stems.
>
>To me, that's a bit counter intuitive. I guess I view filenames as
>always having stems, but extensions being optional. But I don't view
>that as a strong enough argument to change anything.

>Does anyone have a stronger argument than intuition for changing or
>retaining the current behavior?

Hi
I believe the current behavior is correct.
In a scenario where you are looking for files with certain extensions (take .netrc for instance), you want the file .netrc to have netrc extension. In Windows, if there is a dot in the file name, then there is an extension. Another way of seeing the problem: if you are using the extension function, then you expect a result consistent with the majority of OS supporting extensions. Hopefully there are no many different OS interpreting the extension of .netrc differently :-)
Note that Windows makes it hard to create files with empty names and an extension, but if you manage to create it then explorer uses the extension.
I agree that the behavior is not always intuitive, perhaps both stem and extension function documentation should explicitly mention it. It would be nice if you could add .foo and .foo.bar to the path decomposition table.
Thank you for boost::filesystem :-)

Best regards
Jorge


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk