DirectoryAliases.

DirectoryExists(ICakeContext, DirectoryPath) Method

Summary

Determines whether the given path refers to an existing directory.
Namespace
Cake.Common.IO
Containing Type
DirectoryAliases

Syntax

[CakeMethodAlias]
[CakeAliasCategory("Exists")]
public static bool DirectoryExists(this ICakeContext context, DirectoryPath path)

Examples

var dir = "publish";
if (!DirectoryExists(dir))
{
    CreateDirectory(dir);
}

Attributes

Type Description
CakeMethodAliasAttribute An attribute used to mark script method aliases.
CakeAliasCategoryAttribute An attribute used for documentation of alias methods/properties.

Parameters

Name Type Description
context ICakeContext The context.
path DirectoryPath The DirectoryPath to check.

Return Value

Type Description
bool true if path refers to an existing directory; false if the directory does not exist or an error occurs when trying to determine if the specified path exists.