Valid File Path

Cym13 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 31 15:48:43 PDT 2017


On Thursday, 31 August 2017 at 21:59:22 UTC, vino wrote:
> Hi All,
>
>   Can you help me what is wrong in the below program, as the 
> output is empty.
>
> import std.stdio, std.path;
>
> void main ()
> {
> version (Windows)
> {
> auto Path = `C:\#Users\Admin\Desktop\Script\Test1`;
> if(!Path.isValidPath) { writeln("Path Not Valid");}
> }
> }
>
> From,
> Vino.B

It doesn't print anything because the path is valid. Why do you 
expect otherwise?

Note that isValidPath is only used for syntax check, it does not 
checks that the file or directory exists. If that is what you 
want use std.file.exists instead.


More information about the Digitalmars-d-learn mailing list