MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
McroBuild.AbsolutePathExtensions Class Reference

The API NUKE has for AbsolutePath relies heavily on extension methods. In fact if file system operations are expressed with extension methods to AbsolutePath it can yield code which is much more comfortable to write. More...

Static Public Member Functions

static AbsolutePath GetRoot (this AbsolutePath self)
 
static bool IsRoot (this AbsolutePath self)
 
static string RelativeToBase (this AbsolutePath self, AbsolutePath root)
 Return a path connecting from right side as a base to the left side as target.
 
static string BaseRelativeTo (this AbsolutePath self, AbsolutePath subfolder)
 Return a path connecting from left side as a base to the right side as target.
 
static bool FileExists (this AbsolutePath path)
 
static bool DirectoryExists (this AbsolutePath path)
 
static AbsolutePath ExistingFile (this AbsolutePath path)
 Returns null if designated file doesn't exist. This can be used in null-propagating expressions without the need for if statements, like InPath.ExistingFile()?.Parent ?? "/default/path".AsPath().
 
static AbsolutePath ExistingDirectory (this AbsolutePath path)
 Returns null if designated directory doesn't exist. This can be used in null-propagating expressions without the need for if statements, like InPath.ExistingDirectory()?.Parent ?? "/default/path".AsPath().
 
static IEnumerable< AbsolutePathFiles (this AbsolutePath path, string pattern="*", SearchOption searchOption=SearchOption.TopDirectoryOnly)
 Return all files in a directory.
 
static IEnumerable< AbsolutePathDirectories (this AbsolutePath path, string pattern="*", SearchOption searchOption=SearchOption.TopDirectoryOnly)
 Return all subfolders in a directory.
 
static bool HasExtension (this AbsolutePath path, string extension, params string[] alternativeExtensions)
 Returns true if path ends in any of the given extensions. Input extensions should have leading .
 
static AbsolutePath WithExtension (this AbsolutePath path, string extension)
 Replace extension of left-side with~ or add given extension

 
static AbsolutePath CreateDirectory (this AbsolutePath path)
 Creates a new directory or does nothing if that's already exists.
 
static List< AbsolutePathCopy (this AbsolutePath path, AbsolutePath to, string pattern="*")
 Copy a file or a directory recursively to be the target path.
 
static List< AbsolutePathCopyInto (this AbsolutePath path, AbsolutePath intoDirectory, string pattern="*")
 Copy a file or a directory recursively into a target folder.
 
static List< AbsolutePathMove (this AbsolutePath path, AbsolutePath to, string pattern="*")
 Move a file or a directory recursively to be the target path.
 
static List< AbsolutePathMoveInto (this AbsolutePath path, AbsolutePath intoDirectory, string pattern="*")
 Move a file or a directory recursively into a target folder.
 

Detailed Description

The API NUKE has for AbsolutePath relies heavily on extension methods. In fact if file system operations are expressed with extension methods to AbsolutePath it can yield code which is much more comfortable to write.

Most generic path operation functions are taken from NUKE

Definition at line 175 of file AbsolutePath.Build.cs.

Member Function Documentation

◆ BaseRelativeTo()

static string McroBuild.AbsolutePathExtensions.BaseRelativeTo ( this AbsolutePath self,
AbsolutePath subfolder )
static

Return a path connecting from left side as a base to the right side as target.

◆ Copy()

static List< AbsolutePath > McroBuild.AbsolutePathExtensions.Copy ( this AbsolutePath path,
AbsolutePath to,
string pattern = "*" )
static

Copy a file or a directory recursively to be the target path.

Parameters
path
to
patternFilter pattern for files when copying recursively
Returns
The list of new files which has been copied

◆ CopyInto()

static List< AbsolutePath > McroBuild.AbsolutePathExtensions.CopyInto ( this AbsolutePath path,
AbsolutePath intoDirectory,
string pattern = "*" )
static

Copy a file or a directory recursively into a target folder.

Parameters
path
intoDirectory
patternFilter pattern for files when copying recursively
Returns
The list of new files which has been copied

◆ CreateDirectory()

static AbsolutePath McroBuild.AbsolutePathExtensions.CreateDirectory ( this AbsolutePath path)
inlinestatic

Creates a new directory or does nothing if that's already exists.

Returns
Path to created directory (same as left-side)

Definition at line 248 of file AbsolutePath.Build.cs.

◆ Directories()

static IEnumerable< AbsolutePath > McroBuild.AbsolutePathExtensions.Directories ( this AbsolutePath path,
string pattern = "*",
SearchOption searchOption = SearchOption.TopDirectoryOnly )
static

Return all subfolders in a directory.

Parameters
path
patternFilter folders with a globbing pattern
searchOptionIndicate if folders should be taken only from current folder, or any subfolders too

◆ DirectoryExists()

static bool McroBuild.AbsolutePathExtensions.DirectoryExists ( this AbsolutePath path)
static

◆ ExistingDirectory()

static AbsolutePath McroBuild.AbsolutePathExtensions.ExistingDirectory ( this AbsolutePath path)
static

Returns null if designated directory doesn't exist. This can be used in null-propagating expressions without the need for if statements, like InPath.ExistingDirectory()?.Parent ?? "/default/path".AsPath().

Parameters
path
Returns

◆ ExistingFile()

static AbsolutePath McroBuild.AbsolutePathExtensions.ExistingFile ( this AbsolutePath path)
static

Returns null if designated file doesn't exist. This can be used in null-propagating expressions without the need for if statements, like InPath.ExistingFile()?.Parent ?? "/default/path".AsPath().

Parameters
path
Returns

◆ FileExists()

static bool McroBuild.AbsolutePathExtensions.FileExists ( this AbsolutePath path)
static

◆ Files()

static IEnumerable< AbsolutePath > McroBuild.AbsolutePathExtensions.Files ( this AbsolutePath path,
string pattern = "*",
SearchOption searchOption = SearchOption.TopDirectoryOnly )
static

Return all files in a directory.

Parameters
path
patternFilter files with a globbing pattern
searchOptionIndicate if files should be taken only from current folder, or any subfolders too

◆ GetRoot()

static AbsolutePath McroBuild.AbsolutePathExtensions.GetRoot ( this AbsolutePath self)
static

◆ HasExtension()

static bool McroBuild.AbsolutePathExtensions.HasExtension ( this AbsolutePath path,
string extension,
params string[] alternativeExtensions )
static

Returns true if path ends in any of the given extensions. Input extensions should have leading .

◆ IsRoot()

static bool McroBuild.AbsolutePathExtensions.IsRoot ( this AbsolutePath self)
static

◆ Move()

static List< AbsolutePath > McroBuild.AbsolutePathExtensions.Move ( this AbsolutePath path,
AbsolutePath to,
string pattern = "*" )
static

Move a file or a directory recursively to be the target path.

Parameters
path
to
patternFilter pattern for files when moving recursively
Returns
The list of moved files in their new place

◆ MoveInto()

static List< AbsolutePath > McroBuild.AbsolutePathExtensions.MoveInto ( this AbsolutePath path,
AbsolutePath intoDirectory,
string pattern = "*" )
static

Move a file or a directory recursively into a target folder.

Parameters
path
intoDirectory
patternFilter pattern for files when moving recursively
Returns
The list of moved files in their new place

◆ RelativeToBase()

static string McroBuild.AbsolutePathExtensions.RelativeToBase ( this AbsolutePath self,
AbsolutePath root )
static

Return a path connecting from right side as a base to the left side as target.

◆ WithExtension()

static AbsolutePath McroBuild.AbsolutePathExtensions.WithExtension ( this AbsolutePath path,
string extension )
static

Replace extension of left-side with~ or add given extension


The documentation for this class was generated from the following file: