exists

Determine whether the given file (or directory) exists.

  1. bool exists(R name)
  2. bool exists(R name)
    bool
    exists
    (
    R
    )
    (
    auto ref R name
    )

Parameters

name R

string or range of characters representing the file name

Return Value

Type: bool

true if the file name specified as input exists

Examples

auto f = deleteme ~ "does.not.exist";
assert(!f.exists);

f.write("hello");
assert(f.exists);

f.remove;
assert(!f.exists);

Meta