z_path (zotonic_core v1.0.0-rc.17)

Defines all paths for files and directories of a site.

Summary

Functions

Return the absolute path to a file in the 'file' directory

Return the _build/default/lib directory

Return the path to a files subdirectory

Return the path to a files subdirectory and ensure that the directory is present

Get the path to the root dir of the Zotonic install. If the env var 'ZOTONIC' is not set, then return the current working dir.

Return the path to the media archive directory

Return the path to the media preview directory

Return the path to the given module in the given context. The module must have been compiled, so it is present in the code path.

Return the path to the site folder of the given context. The site must have been compiled.

Find the source directory of a site.

The directory of the user-defined sites

Functions

abspath(Path, Context)

-spec abspath(file:filename_all(), z:context()) -> file:filename_all() | {error, bad_name}.

Return the absolute path to a file in the 'file' directory

build_lib_dir()

-spec build_lib_dir() -> file:filename_all().

Return the _build/default/lib directory

files_subdir(SubDir, Context)

-spec files_subdir(file:filename_all(), z:context()) -> file:filename_all() | {error, bad_name}.

Return the path to a files subdirectory

files_subdir_ensure(SubDir, Context)

-spec files_subdir_ensure(file:filename_all(), z:context()) -> file:filename_all() | {error, bad_name}.

Return the path to a files subdirectory and ensure that the directory is present

get_path()

-spec get_path() -> file:filename_all().

Get the path to the root dir of the Zotonic install. If the env var 'ZOTONIC' is not set, then return the current working dir.

media_archive(Context)

-spec media_archive(z:context()) -> file:filename_all() | {error, bad_name}.

Return the path to the media archive directory

media_preview(Context)

-spec media_preview(z:context()) -> file:filename_all() | {error, bad_name}.

Return the path to the media preview directory

module_dir(Module)

-spec module_dir(atom()) -> file:filename_all() | {error, bad_name}.

Return the path to the given module in the given context. The module must have been compiled, so it is present in the code path.

site_dir(Context)

-spec site_dir(z:context() | atom()) -> file:filename_all() | {error, bad_name}.

Return the path to the site folder of the given context. The site must have been compiled.

site_source_dir(Context)

-spec site_source_dir(z:context() | atom()) -> file:filename_all() | {error, bad_name}.

Find the source directory of a site.

zotonic_apps()

-spec zotonic_apps() -> file:filename_all().

The directory of the user-defined sites