DirectoryAliases.

MakeRelative(ICakeContext, DirectoryPath, DirectoryPath) Method

Summary

Makes the directory path relative (if absolute) to a specified root directory. If no root directory is defined the current working directory is used as default root.
Namespace
Cake.Common.IO
Containing Type
DirectoryAliases

Syntax

[CakeMethodAlias]
[CakeAliasCategory("Path")]
public static DirectoryPath MakeRelative(this ICakeContext context, DirectoryPath path, DirectoryPath rootPath = null)

Examples

var path = MakeRelative(Directory("C:\Cake\Tests\Integration"));

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 path.
rootPath DirectoryPath The root path.

Return Value

Type Description
DirectoryPath A relative directory path.