View Source GriffinSSG.Filesystem (Griffin v0.3.0)

Helper functions for handling basic file operations

Summary

Functions

Copies a list of files or directories into the destination directory. When successful, returns {:ok, count} where count is the number of copied files. if successful or {:errors, list(string())} when one or more copy operations failed. In case of error, the destination directory will be left in a dirty state, and only some of the files might have been copied.

Lists all files from a path or wildcard. If filepath is a path to a file, returns a list with only that filepath. If filepath points to a directory, returns a list of all files inside that directory and subdirectories. A list of ignored paths can be passed in to opts. The default value for opts is [".git", ".elixir_ls"]

Calculates the output path for a file. The filepath is a contained within input_dir, which means that to calculate the filepath in the output directory we need to see what is the filepath relative to the input_dir. The end result is a concatenation of the output_dir with this relative path.

Searches a given path for files that have the selected extensions

Functions

Link to this function

copy_all(files, destination)

View Source

Copies a list of files or directories into the destination directory. When successful, returns {:ok, count} where count is the number of copied files. if successful or {:errors, list(string())} when one or more copy operations failed. In case of error, the destination directory will be left in a dirty state, and only some of the files might have been copied.

Link to this function

git_ignores(path \\ ".gitignore")

View Source
Link to this function

list_all(filepath, opts \\ [".git", ".elixir_ls"])

View Source

Lists all files from a path or wildcard. If filepath is a path to a file, returns a list with only that filepath. If filepath points to a directory, returns a list of all files inside that directory and subdirectories. A list of ignored paths can be passed in to opts. The default value for opts is [".git", ".elixir_ls"]

Link to this function

output_filepath(filepath, input_dir, output_dir)

View Source

Calculates the output path for a file. The filepath is a contained within input_dir, which means that to calculate the filepath in the output directory we need to see what is the filepath relative to the input_dir. The end result is a concatenation of the output_dir with this relative path.

Link to this function

search_directory(path, extensions)

View Source

Searches a given path for files that have the selected extensions