isDir

Returns whether the given file is a directory.

  1. bool isDir [@property getter]
  2. bool isDir [@property getter]
    @property
    bool
    isDir
    (
    R
    )
    (
    auto ref R name
    )

Parameters

name R

The path to the file.

Return Value

Type: bool

true if name specifies a directory

Throws

FileException if the given file does not exist.

Examples

import std.exception : assertThrown;

auto dir = deleteme ~ "dir";
auto f = deleteme ~ "f";
scope(exit) dir.rmdir, f.remove;

assert(!dir.exists);
assertThrown!FileException(dir.isDir);

dir.mkdir;
assert(dir.isDir);

f.write(".");
assert(!f.isDir);

Meta