On 20.07.2011 19:36, Lars T. Kyllingstad wrote:
On Mon, 18 Jul 2011 14:51:06 -0400, Steven Schveighoffer wrote:It's definitely something to think about. At the very least, I think the default file system case sensitivity should be mapped to a certain function. It doesn't hurt to expose the opposite sensitivity as an alternate (you need to implement both anyway). A template with all options defaulted for the current OS makes good sense I think. Actually, expanding/renaming pathCharMatch provides a perfect way to default these: e.g.: version(Windows) { enum defaultOSSensitivity = false; enum defaultOSDirSeps = `\/`; } else version(Posix) { enum defaultOSSensitivity = true; enum defaultOSDirSeps = "/"; } // replaces pathCharMatch int pathCharCmp(bool caseSensitive = defaultOSSensitivity, string dirseps = defaultOSDirSeps)(dchar a, dchar b); int fcmp(alias pred = "pathCharCmp(a, b)", S1, S2)(S1 filename1, S2 filename2); Anyone who wants to do alternate comparisons is free to do so using other options from pathCharCmp.Good idea. I'll probably implement something like that.
I like the direction that this is heading. If the idea gets extended to other functions as well, you won't have to reimplement std.path if you have to deal with posix paths on windows and vice versa, e.g. when transferring data containing paths between different systems.
