Filesystem/Join

From CommonJS Spec Wiki
Jump to: navigation, search

Definition

Unit Tests

Show of Hands

A: implicitly uses "normal" to normalize the result, so all empty, ".", and ".." path components are resolved if possible. This is our "normal" definition, which is distinct from "canonical" and "absolute" in that it does not consult the underlying storage or the current working directory.

for: join("foo", "..", "bar") == "bar" and join("..", "foo") == "../foo"

against: join("foo", "..", "bar") == "foo/../bar"

B: recognizes and follows absolute paths.

for: join("foo", "/bar") == "/bar" (Unix) join("Foo", "c:\\Bar") == "c:\\Bar" (Microsoft)

against: join("foo", "/bar") == "foo/bar"

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox