DirectoryAliases.

MakeRelative(ICakeContext, FilePath, DirectoryPath) Method

Summary

Makes the file 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 FilePath MakeRelative(this ICakeContext context, FilePath path, DirectoryPath rootPath = null)

Examples

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

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

Return Value

Type Description
FilePath A relative file path.