exists

Check if a exists.

  1. bool exists(Path a)
  2. bool exists(FilePath a)
  3. bool exists(DirPath a)
    @safe nothrow
    @nogc => typeof(return)(std_exists(a.str))
    bool
    exists
    ()
  4. bool exists(FileName a)
  5. bool exists(DirName a)

Examples

verify a.toString when a being scope parameter

import std.meta : AliasSeq;

static foreach (T; AliasSeq!(Path, FilePath, DirPath, FileName, DirName)) {{
	static void f(in T a) { const _ = a.toString; }
	f(T.init);
}}
assert( Path("/etc/").exists);
assert(!Path("/etcxyz/").exists);
assert( DirPath("/etc/").exists);
assert(!DirPath("/etcxyz/").exists);
assert( FilePath("/etc/passwd").exists);
assert(!FileName("dsfdsfdsfdsfdfdsf").exists);
assert(!DirName("dsfdsfdsfdsfdfdsf").exists);

Meta