On Friday 22 May 2015 14:52:30 Gavin Lambert wrote:
Also note that for the environment variables that do contain multi-paths, there are two separate delimiters in play -- one is the separator between entire paths, and the other is the separator between components of a single path. Both of them are platform-specific.
It seems reasonable (though not essential) for an Environment library to take care of the former for you by providing split/rejoin methods that hide the difference between platforms.
+1
It seems out of scope for it to do the latter, as this is already handled by the Filesystem library, and duplicating it seems wasteful.
Hence the suggestion to have Environment provide split/join methods that use Filesystem path objects as a basis (ie. vector<path>), as this allows the most platform abstraction. And as others have already pointed out, Filesystem has been standardised already.
Note that not only paths can be present in multi-element env. variables. For example, LS_COLORS contains a list of color specifications for ls command. I think, it's better for the environment library to perform a split to a sequence of strings and let the user interpret those strings as filesystem paths or something else.