On Tue, 01 Mar 2011 11:07:15 -0500, Steven Schveighoffer wrote: > On Tue, 01 Mar 2011 11:04:52 -0500, Lars T. Kyllingstad > <[email protected]> wrote: > >> On Tue, 01 Mar 2011 10:55:57 -0500, Steven Schveighoffer wrote: >> >>> The point of this whole discussion is how should phobos' std.path deal >>> with filenames. I thought that was implied. >> >> But std.path doesn't have to deal with these issues. std.path is >> basically a bunch of functions that search for '/', '\' or '.' in some >> string. The only special case it needs to worry about is that '\' is >> an ordinary character on POSIX and a dir separator on Windows. >> >> If you want to disallow creating files named "-rf *", that'll have to >> be done in std.stdio and std.file. > > Well, then that's probably where it should be disallowed then. You are > right, path shouldn't care about the contents, because looking at a path > does not cause problem, it's only creating a file based on the given > path that causes problems.
std.path *could*, however, contain an isSafePath() function that checks whether a given path contains special characters. And if we define "special characters" as "characters not allowed in Windows filenames" it would double as a Windows filename validator. -Lars
