Module luarocks.path
Path and filename handling functions. All paths are configured in this module, making it a single point where the layout of the local installation is defined in LuaRocks.
Functions
bin_dir (name, version, repo, rocks_dir) | Get the local installation directory for command-line scripts of a package. |
conf_dir (name, version, repo, rocks_dir) | Get the local installation directory for configuration files of a package. |
configure_paths (rockspec) | Set up path-related variables for a given rock. |
doc_dir (name, version, repo, rocks_dir) | Get the local installation directory for documentation of a package. |
install_dir (name, version, repo, rocks_dir) | Get the local installation directory (prefix) for a package. |
lib_dir (name, version, repo, rocks_dir) | Get the local installation directory for C libraries of a package. |
lua_dir (name, version, repo, rocks_dir) | Get the local installation directory for Lua modules of a package. |
make_url (pathname, name, version, arch) | Make a rockspec or rock URL. |
module_to_path (mod) | Obtain the directory name where a module should be stored. |
parse_rock_name (rock_file) | Extract name, version and arch of a rock filename. |
parse_rockspec_name (rockspec_file) | Extract name and version of a rockspec filename. |
path_to_module (file) | Convert a pathname to a module identifier. |
rock_manifest_file (name, version, repo, rocks_dir) | Get the local filename of the rock_manifest file of an installed rock. |
rockspec_file (name, version, repo, rocks_dir) | Get the local filename of the rockspec of an installed rock. |
rockspec_name_from_rock (rock_name) | Infer rockspec filename from a rock filename. |
versions_dir (name, repo, rocks_dir) | Get the repository directory for all versions of a package. |
Functions
- bin_dir (name, version, repo, rocks_dir)
-
Get the local installation directory for command-line scripts of a package.
Parameters
- name: string: The package name.
- version: string: The package version.
- repo:
- rocks_dir: string or nil: If given, specifies the local repository to use.
Return value:
string: The resulting path -- does not guarantee that the package (and by extension, the path) exists. - conf_dir (name, version, repo, rocks_dir)
-
Get the local installation directory for configuration files of a package.
Parameters
- name: string: The package name.
- version: string: The package version.
- repo:
- rocks_dir: string or nil: If given, specifies the local repository to use.
Return value:
string: The resulting path -- does not guarantee that the package (and by extension, the path) exists. - configure_paths (rockspec)
-
Set up path-related variables for a given rock. Create a "variables" table in the rockspec table, containing adjusted variables according to the configuration file.
Parameters
- rockspec: table: The rockspec table.
- doc_dir (name, version, repo, rocks_dir)
-
Get the local installation directory for documentation of a package.
Parameters
- name: string: The package name.
- version: string: The package version.
- repo:
- rocks_dir: string or nil: If given, specifies the local repository to use.
Return value:
string: The resulting path -- does not guarantee that the package (and by extension, the path) exists. - install_dir (name, version, repo, rocks_dir)
-
Get the local installation directory (prefix) for a package.
Parameters
- name: string: The package name.
- version: string: The package version.
- repo:
- rocks_dir: string or nil: If given, specifies the local repository to use.
Return value:
string: The resulting path -- does not guarantee that the package (and by extension, the path) exists. - lib_dir (name, version, repo, rocks_dir)
-
Get the local installation directory for C libraries of a package.
Parameters
- name: string: The package name.
- version: string: The package version.
- repo:
- rocks_dir: string or nil: If given, specifies the local repository to use.
Return value:
string: The resulting path -- does not guarantee that the package (and by extension, the path) exists. - lua_dir (name, version, repo, rocks_dir)
-
Get the local installation directory for Lua modules of a package.
Parameters
- name: string: The package name.
- version: string: The package version.
- repo:
- rocks_dir: string or nil: If given, specifies the local repository to use.
Return value:
string: The resulting path -- does not guarantee that the package (and by extension, the path) exists. - make_url (pathname, name, version, arch)
-
Make a rockspec or rock URL.
Parameters
- pathname: string: Base URL or pathname.
- name: string: Package name.
- version: string: Package version.
- arch: string: Architecture identifier, or "rockspec" or "installed".
Return value:
string: A URL or pathname following LuaRocks naming conventions. - module_to_path (mod)
-
Obtain the directory name where a module should be stored. For example, on Unix, "foo.bar.baz" will return "foo/bar".
Parameters
- mod: string: A module name in Lua dot-separated format.
Return value:
string: A directory name using the platform's separator. - parse_rock_name (rock_file)
-
Extract name, version and arch of a rock filename.
Parameters
- rock_file: string: pathname of a rock
Return value:
(string, string, string) or nil: name, version and arch of rock, or nil if name could not be parsed - parse_rockspec_name (rockspec_file)
-
Extract name and version of a rockspec filename.
Parameters
- rockspec_file: string: pathname of a rockspec
Return value:
(string, string) or nil: name and version of rockspec, or nil if name could not be parsed - path_to_module (file)
-
Convert a pathname to a module identifier. In Unix, for example, a path "foo/bar/baz.lua" is converted to "foo.bar.baz"; "bla/init.lua" returns "bla"; "foo.so" returns "foo".
Parameters
- file: string: Pathname of module
Return value:
string: The module identifier, or nil if given path is not a conformant module path (the function does not check if the path actually exists). - rock_manifest_file (name, version, repo, rocks_dir)
-
Get the local filename of the rock_manifest file of an installed rock.
Parameters
- name: string: The package name.
- version: string: The package version.
- repo:
- rocks_dir: string or nil: If given, specifies the local repository to use.
Return value:
string: The resulting path -- does not guarantee that the package (and by extension, the file) exists. - rockspec_file (name, version, repo, rocks_dir)
-
Get the local filename of the rockspec of an installed rock.
Parameters
- name: string: The package name.
- version: string: The package version.
- repo:
- rocks_dir: string or nil: If given, specifies the local repository to use.
Return value:
string: The resulting path -- does not guarantee that the package (and by extension, the file) exists. - rockspec_name_from_rock (rock_name)
-
Infer rockspec filename from a rock filename.
Parameters
- rock_name: string: Pathname of a rock file.
Return value:
string: Filename of the rockspec, without path. - versions_dir (name, repo, rocks_dir)
-
Get the repository directory for all versions of a package.
Parameters
- name: string: The package name.
- repo:
- rocks_dir: string or nil: If given, specifies the local repository to use. the package (and by extension, the path) exists.
Return value:
string: The resulting path -- does not guarantee that