Skylib module containing utility functions related to directories.

directory_glob


directory_glob(<a href="#directory_glob-directory">directory</a>, <a href="#directory_glob-include">include</a>, <a href="#directory_glob-allow_empty">allow_empty</a>)

native.glob, but for DirectoryInfo.

PARAMETERS

NameDescriptionDefault Value
directory(DirectoryInfo) The directory to look relative from.none
include(List[string]) A list of globs to match.none
allow_empty(bool) Whether to allow a glob to not match any files.False

RETURNS

depset[File] A set of files that match.

directory_glob_chunk


directory_glob_chunk(<a href="#directory_glob_chunk-directory">directory</a>, <a href="#directory_glob_chunk-chunk">chunk</a>)

Given a directory and a chunk of a glob, returns possible candidates.

PARAMETERS

NameDescriptionDefault Value
directory(DirectoryInfo) The directory to look relative from.none
chunk(string) A chunk of a glob to look at.none

RETURNS

List[Either[DirectoryInfo, File]]] The candidate next entries for the chunk.

directory_single_glob


directory_single_glob(<a href="#directory_single_glob-directory">directory</a>, <a href="#directory_single_glob-glob">glob</a>)

Calculates all files that are matched by a glob on a directory.

PARAMETERS

NameDescriptionDefault Value
directory(DirectoryInfo) The directory to look relative from.none
glob(string) A glob to match.none

RETURNS

List[File] A list of files that match.

get_child


get_child(<a href="#get_child-directory">directory</a>, <a href="#get_child-name">name</a>, <a href="#get_child-require_dir">require_dir</a>, <a href="#get_child-require_file">require_file</a>)

Gets the direct child of a directory.

PARAMETERS

NameDescriptionDefault Value
directory(DirectoryInfo) The directory to look within.none
name(string) The name of the directory/file to look for.none
require_dir(bool) If true, throws an error if the value is not a directory.False
require_file(bool) If true, throws an error if the value is not a file.False

RETURNS

(File|DirectoryInfo) The content contained within.

get_relative


get_relative(<a href="#get_relative-directory">directory</a>, <a href="#get_relative-path">path</a>, <a href="#get_relative-require_dir">require_dir</a>, <a href="#get_relative-require_file">require_file</a>)

Gets a subdirectory contained within a tree of another directory.

PARAMETERS

NameDescriptionDefault Value
directory(DirectoryInfo) The directory to look within.none
path(string) The path of the directory to look for within it.none
require_dir(bool) If true, throws an error if the value is not a directory.False
require_file(bool) If true, throws an error if the value is not a file.False

RETURNS

(File|DirectoryInfo) The directory contained within.

transitive_entries


transitive_entries(<a href="#transitive_entries-directory">directory</a>)

Returns the files and directories contained within a directory transitively.

PARAMETERS

NameDescriptionDefault Value
directory(DirectoryInfo) The directory to look atnone

RETURNS

List[Either[DirectoryInfo, File]] The entries contained within.