Note: This is the migration API reference for FAKE 5. The new (modularized) API documentation can be found here. If the API is already migrated you can check here if exists in a module. More information regarding the migration can be found here

Path

Contains helper function which allow to deal with files and directories.

Functions and values

Function or valueDescription
Path.changeExtension extension fileName
Signature: extension:string -> fileName:string -> string

Change the extension of the file.

Parameters

  • 'extension' - The new extension containing the leading '.'.
  • 'fileName' - Name of the file from which the extension is retrieved.
Path.combine path1 path2
Signature: path1:string -> path2:string -> string

Combines two path strings using Path.Combine

Path.combineTrimEnd path1 path2
Signature: path1:string -> path2:string -> string

Combines two path strings using Path.Combine

Path.convertWindowsToCurrentPath(...)
Signature: windowsPath:string -> string

Convert the given windows path to a path in the current system

Path.directorySeparator
Signature: string

The directory separator string. On most systems / or \

Path.getDirectory(path)
Signature: path:string -> string

Get the directory of the specified path

Parameters

  • 'path' - The path from which the directory is retrieved.
Path.getFullName(p)
Signature: p:string -> string
Path.hasExtension extension fileName
Signature: extension:string -> fileName:string -> bool

Tests whether the file has specified extensions (containing the leading '.')

Parameters

  • 'extension' - The extension to fine containing the leading '.'.
  • 'fileName' - Name of the file from which the extension is retrieved.
Path.isDirectory(path)
Signature: path:string -> bool

Detects whether the given path is a directory.

Path.isFile(path)
Signature: path:string -> bool

Detects whether the given path is a file.

Path.isValidPath(path)
Signature: path:string -> bool

Detects whether the given path does not contains invalid characters.

Path.normalizeFileName(fileName)
Signature: fileName:string -> string

Normalizes a filename.

Path.shortenCurrentDirectory(path)
Signature: path:string -> string

Replaces any occurence of the currentDirectory with .

Path.toRelativeFrom
Signature: string -> string -> string
Path.toRelativeFromCurrent(path)
Signature: path:string -> string