API:FS.fullPath

From Spherical
Revision as of 17:34, 17 August 2017 by Bruce Pascoe (talk | contribs) (FS.fullPath() API page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The FS.fullPath() function computes the canonical SphereFS pathname for a specified relative path and base directory.

Usage
canon_path = FS.fullPath(file_or_dir_name[, base_path]);

API Information

Description

FS.fullPath() returns the complete, canonical SphereFS pathname for a given file or directory. If the path to be resolved already includes a SphereFS prefix such as @/ or ~/, then Sphere simply canonicalizes it (by removing any relative components); otherwise the path itself is considered relative and will be rebased before canonicalization. This allows you to get the full pathname of a file or directory given only its name and a known base directory, which can be useful in libraries.

Parameters

Name Type Default Value Description
file_or_dir_name string n/a (Required) The name of a file or directory. May include path components. It doesn't need to actually exist.
base_path string "@/" Specifies the base directory onto which relative paths will be rebased.

Return Value

The full SphereFS pathname of the specified file or directory.

See Also