Module rebar_dir

utility functions for directory and path handling of all kind.

Description

utility functions for directory and path handling of all kind.

Data Types

rebar_dict()

rebar_dict() = dict:dict()

Function Index

all_src_dirs/1returns all the source directories (src_dirs and extra_src_dirs).
all_src_dirs/3returns all the source directories (src_dirs and extra_src_dirs) while being able to configure defaults for both.
base_dir/1returns the directory root for build artifacts for the current profile, such as _build/default/.
checkouts_dir/1returns the expected location of the _checkouts directory.
checkouts_dir/2returns the expected location of a given app in the checkouts directory for the project.
checkouts_out_dir/1returns the location of the directory checkouts are built to.
checkouts_out_dir/2returns the expected location of a given app in the checkouts directory for the project.
deps_dir/1returns the directory where dependencies should be placed given the current profile.
deps_dir/2returns the directory where a dependency should be placed given the current profile, based on its app name.
extra_src_dirs/1same as src_dirs/1, but for the extra_src_dirs options.
extra_src_dirs/2same as src_dirs/2, but for the extra_src_dirs options.
format_source_file_name/1
format_source_file_name/2
get_cwd/0returns the current working directory, with some specific conversions and handling done to be cross-platform compatible.
global_cache_dir/1returns the location for the global cache directory.
global_config/0returns the default path of the global rebar.config file.
global_config/1returns the path of the global rebar.config file.
global_config_dir/1returns the directory where the global configuration files for rebar3 may be stored.
home_dir/0returns the user's home directory.
lib_dirs/1returns the list of relative path where the project applications can be located.
local_cache_dir/1appends the cache directory to the path passed to this function.
make_relative_path/2take a source and a target path, and relativize the target path onto the source.
plugins_dir/1Returns the directory where plugins are located.
processing_base_dir/1checks if the current working directory is the base directory for the project.
processing_base_dir/2checks if the passed in directory is the base directory for the project.
profile_dir/2returns the directory root for build artifacts for a given set of profiles.
profile_dir_name/1returns the directory name for build artifacts for a given set of profiles.
project_plugin_dirs/1returns the list of relative path where the project plugins can be located.
recursive/2 Return the value of the 'recursive' option for the given directory.
retarget_path/2given a path if that path is an ancestor of an app dir, return the path relative to that apps outdir.
root_dir/1returns the absolute path for the project root (by default, the current working directory for the currently running escript).
src_dir_opts/2 Return the list of options for the given src directory If the same option is given multiple times for a directory in the config, the priority order is: first occurrence of src_dirs followed by first occurrence of extra_src_dirs.
src_dirs/1 src_dirs and extra_src_dirs can be configured with options like this:
   {src_dirs,[{"foo",[{recursive,false}]}]}
   {extra_src_dirs,[{"bar",[recursive]}]} (equivalent to {recursive,true})
src_dirs/1,2 and extra_src_dirs/1,2 return only the list of directories for the src_dirs and extra_src_dirs options respectively, while src_dirs_opts/2 returns the options list for the given directory, no matter if it is configured as src_dirs or extra_src_dirs.
src_dirs/2same as src_dirs/1, but allows to pass in a list of default options.
template_dir/1returns the location for the global template directory.
template_globals/1returns the file location for the global template configuration variables file.

Function Details

all_src_dirs/1

all_src_dirs(Opts::rebar_dict()) -> [file:filename_all()]

returns all the source directories (src_dirs and extra_src_dirs).

all_src_dirs/3

all_src_dirs(Opts::rebar_dict(), SrcDefault::[file:filename_all()], ExtraDefault::[file:filename_all()]) -> [file:filename_all()]

returns all the source directories (src_dirs and extra_src_dirs) while being able to configure defaults for both.

base_dir/1

base_dir(State::rebar_state:t()) -> file:filename_all()

returns the directory root for build artifacts for the current profile, such as _build/default/.

checkouts_dir/1

checkouts_dir(State::rebar_state:t()) -> file:filename_all()

returns the expected location of the _checkouts directory.

checkouts_dir/2

checkouts_dir(State::rebar_state:t(), App::file:filename_all()) -> file:filename_all()

returns the expected location of a given app in the checkouts directory for the project.

checkouts_out_dir/1

checkouts_out_dir(State::rebar_state:t()) -> file:filename_all()

returns the location of the directory checkouts are built to

checkouts_out_dir/2

checkouts_out_dir(State::rebar_state:t(), App::file:filename_all()) -> file:filename_all()

returns the expected location of a given app in the checkouts directory for the project.

deps_dir/1

deps_dir(State::rebar_state:t()) -> file:filename_all()

returns the directory where dependencies should be placed given the current profile.

deps_dir/2

deps_dir(DepsDir::file:filename_all(), App::file:filename_all()) -> file:filename_all()

returns the directory where a dependency should be placed given the current profile, based on its app name. Expects to be passed the result of deps_dir/1 as a first argument.

extra_src_dirs/1

extra_src_dirs(Opts::rebar_dict()) -> [file:filename_all()]

same as src_dirs/1, but for the extra_src_dirs options

extra_src_dirs/2

extra_src_dirs(Opts::rebar_dict(), Default::[file:filename_all()]) -> [file:filename_all()]

same as src_dirs/2, but for the extra_src_dirs options

format_source_file_name/1

format_source_file_name(Path) -> any()

format_source_file_name/2

format_source_file_name(Path, Opts) -> any()

get_cwd/0

get_cwd() -> file:filename_all()

returns the current working directory, with some specific conversions and handling done to be cross-platform compatible.

global_cache_dir/1

global_cache_dir(Opts::rebar_dict()) -> file:filename_all()

returns the location for the global cache directory

global_config/0

global_config() -> file:filename_all()

returns the default path of the global rebar.config file

global_config/1

global_config(State::rebar_state:t()) -> file:filename_all()

returns the path of the global rebar.config file

global_config_dir/1

global_config_dir(State::rebar_state:t()) -> file:filename_all()

returns the directory where the global configuration files for rebar3 may be stored.

home_dir/0

home_dir() -> file:filename_all()

returns the user's home directory.

lib_dirs/1

lib_dirs(State::rebar_state:t()) -> file:filename_all()

returns the list of relative path where the project applications can be located.

local_cache_dir/1

local_cache_dir(Dir::file:filename_all()) -> file:filename_all()

appends the cache directory to the path passed to this function.

make_relative_path/2

make_relative_path(Source::file:filename(), Target::file:filename()) -> file:filename()

take a source and a target path, and relativize the target path onto the source.

Example:
  1> rebar_dir:make_relative_path("a/b/c/d/file", "a/b/file").
  "c/d/file"
  2> rebar_dir:make_relative_path("a/b/file", "a/b/c/d/file").
  "../../file"

plugins_dir/1

plugins_dir(State::rebar_state:t()) -> file:filename_all()

Returns the directory where plugins are located.

processing_base_dir/1

processing_base_dir(State::rebar_state:t()) -> boolean()

checks if the current working directory is the base directory for the project.

processing_base_dir/2

processing_base_dir(State::rebar_state:t(), Dir::file:filename()) -> boolean()

checks if the passed in directory is the base directory for the project.

profile_dir/2

profile_dir(Opts::rebar_dict(), Profiles::[atom(), ...]) -> file:filename_all()

returns the directory root for build artifacts for a given set of profiles.

profile_dir_name/1

profile_dir_name(State::rebar_state:t()) -> file:filename_all()

returns the directory name for build artifacts for a given set of profiles.

project_plugin_dirs/1

project_plugin_dirs(State::rebar_state:t()) -> [file:filename_all()]

returns the list of relative path where the project plugins can be located.

recursive/2

recursive(Opts::rebar_dict(), Dir::file:filename_all()) -> boolean()

Return the value of the 'recursive' option for the given directory. If not given, the value of 'recursive' in the 'erlc_compiler' options is used, and finally the default is 'true'.

retarget_path/2

retarget_path(State::rebar_state:t(), Path::string()) -> string()

given a path if that path is an ancestor of an app dir, return the path relative to that apps outdir. If the path is not an ancestor to any app dirs but is an ancestor of the project root, return the path relative to the project base_dir. If it is not an ancestor of either return it unmodified

root_dir/1

root_dir(State) -> any()

returns the absolute path for the project root (by default, the current working directory for the currently running escript).

src_dir_opts/2

src_dir_opts(Opts::rebar_dict(), Dir::file:filename_all()) -> [{atom(), term()}]

Return the list of options for the given src directory If the same option is given multiple times for a directory in the config, the priority order is: first occurrence of src_dirs followed by first occurrence of extra_src_dirs.

src_dirs/1

src_dirs(Opts::rebar_dict()) -> [file:filename_all()]

src_dirs and extra_src_dirs can be configured with options like this:

   {src_dirs,[{"foo",[{recursive,false}]}]}
   {extra_src_dirs,[{"bar",[recursive]}]} (equivalent to {recursive,true})
src_dirs/1,2 and extra_src_dirs/1,2 return only the list of directories for the src_dirs and extra_src_dirs options respectively, while src_dirs_opts/2 returns the options list for the given directory, no matter if it is configured as src_dirs or extra_src_dirs.

src_dirs/2

src_dirs(Opts::rebar_dict(), Default::[file:filename_all()]) -> [file:filename_all()]

same as src_dirs/1, but allows to pass in a list of default options.

template_dir/1

template_dir(State::rebar_state:t()) -> file:filename_all()

returns the location for the global template directory

template_globals/1

template_globals(State::rebar_state:t()) -> file:filename_all()

returns the file location for the global template configuration variables file.


Generated by EDoc