dgs.utils.files

Contains helper functions for loading and interacting with files and paths.

Module Functions

is_abs_dir(filepath)

Returns whether this filepath is an existing absolute directory.

is_abs_file(filepath)

Returns whether this filepath is an existing files absolute path.

is_dir(filepath)

Returns whether this filepath is an existing directory either everywhere or from this project.

is_file(filepath)

Returns whether this filepath is an existing file either everywhere or from this project.

is_project_dir(filepath[, root])

Returns whether this filepath is a path of an existing directory in this project.

is_project_file(filepath[, root])

Returns whether this filepath is an existing path in this project.

mkdir_if_missing(dirname)

Creates leaf directory and all intermediates if it is missing.

read_json(filepath)

Reads json file from a path.

to_abspath(filepath[, root])

Given a path return the absolute path of this file or directory.

write_json(obj, filepath)

Writes to a json file.