Skylib module containing utility functions related to directories.

directory_glob

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

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

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

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

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

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.