[Issue 7002] New: std.path needs a isValidFilePath function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 24 13:11:33 PST 2011


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: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at 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: -------


More information about the Digitalmars-d-bugs mailing list