http://d.puremagic.com/issues/show_bug.cgi?id=7002

           Summary: std.path needs a isValidFilePath function
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nob...@puremagic.com
        ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2011-11-24 
13:10:38 PST ---
I currently see no way of verifying that a given path is a path to a *file* and
not a folder, IOW I want this assert to pass:

assert(isValidFilePath(r"C:\folder\file"))

but the following one to fail, because 'file' in this case is syntactically a
folder:

assert(isValidFilePath(r"C:\folder\file\"))

Using basename and isValidFilename isn't a workaround as basename strips the
slash:

auto file = r"C:\folder\file\";
assert(file.baseName.isValidFilename);  // passes, baseName returns "file"

Either we implement a isValidFilePath function, or a "fileName" function which
could be used like so:

auto file = r"C:\folder\file\";
assert(file.fileName.isValidFilename);  // this would fail, as expected

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to