(absolute-path? path)
Returns true if the given argument is an absolute path.
Returns true if the given argument is an absolute path.
(ensure-trailing-separator path)
If the path given does not have a trailing separator, returns a new path that has one.
If the path given does not have a trailing separator, returns a new path that has one.
(normalize path)
Cleans up a path so that it has no leading/trailing whitespace, and removes any unremovable same-/parent-dir references. Takes the path argument as a string and returns its result as a string.
Cleans up a path so that it has no leading/trailing whitespace, and removes any unremovable same-/parent-dir references. Takes the path argument as a string and returns its result as a string.
(normalize* path-pieces)
Cleans up a path so that it has no leading/trailing whitespace, and removes any removable same-/parent-dir references. path-pieces should be a path vector in the format returned by parse-path; return value is a vector in the same format.
Cleans up a path so that it has no leading/trailing whitespace, and removes any removable same-/parent-dir references. path-pieces should be a path vector in the format returned by parse-path; return value is a vector in the same format.
(parse-path path)
Given a j.io.File or string containing a relative or absolute path, returns the corresponding path vector data structure described at the top of the file.
This function does not do any normalization or simplification. However, because there is more than one way to write some paths, some simplification might happen anyways, such as if the path starts with a (redundant) ".".
Given a j.io.File or string containing a relative or absolute path, returns the corresponding path vector data structure described at the top of the file. This function does not do any normalization or simplification. However, because there is more than one way to write some paths, some simplification might happen anyways, such as if the path starts with a (redundant) ".".
(relativize base-path dest-path)
Takes two absolute paths or two relative paths, and returns a relative path that indicates the same file system location as destination-path, but relative to base-path.
Takes two absolute paths or two relative paths, and returns a relative path that indicates the same file system location as destination-path, but relative to base-path.
(relativize* base-path dest-path)
Takes two absolute paths or two relative paths, and returns a relative path that indicates the same file system location as dest-path, but relative to base-path. Paths should be path vectors, and the return value is also a path vector.
Takes two absolute paths or two relative paths, and returns a relative path that indicates the same file system location as dest-path, but relative to base-path. Paths should be path vectors, and the return value is also a path vector.
(render-path path-pieces)
Given a seq of path elements as created by parse-path, returns a string containing the path represented. This function will only ever use unix-style path rules, so an absolute path will always start with the "/" separator.
NOTE: It is NOT the goal of this function to perform normalization, it just renders what it is given. HOWEVER, that does NOT mean that it is always true that (= (render-path (parse-path some-path)) some-path). That is, you may not render the exact same string you parsed. This is because the path syntax does not have exactly one way to write every path.
Given a seq of path elements as created by parse-path, returns a string containing the path represented. This function will only ever use unix-style path rules, so an absolute path will always start with the "/" separator. NOTE: It is NOT the goal of this function to perform normalization, it just renders what it is given. HOWEVER, that does NOT mean that it is always true that (= (render-path (parse-path some-path)) some-path). That is, you may not render the exact same string you parsed. This is because the path syntax does not have exactly one way to write every path.
(resolve base-path other-path)
Resolve the other-path against the base-path. If other-path is absolute, the result is other-path. If other-path is nil, the result is base-path. Otherwise, the result is other-path concatenated onto base-path. Does not normalize its output. Accepts an optional third argument containing a string with the path separator to use.
Resolve the other-path against the base-path. If other-path is absolute, the result is other-path. If other-path is nil, the result is base-path. Otherwise, the result is other-path concatenated onto base-path. Does not normalize its output. Accepts an optional third argument containing a string with the path separator to use.
(resolve* base-path other-path)
Resolve the other-path against the base-path. If other-path is absolute, the result is other-path. If other-path is nil, the result is base-path. Otherwise, the result is other-path concatenated onto base-path. Does not normalize its output. All inputs and outputs are path vectors.
Resolve the other-path against the base-path. If other-path is absolute, the result is other-path. If other-path is nil, the result is base-path. Otherwise, the result is other-path concatenated onto base-path. Does not normalize its output. All inputs and outputs are path vectors.
(split-url-on-path url-or-string)
Given a URL or string containing a URL, returns a vector of the three component strings: the stuff before the path, the path, and the stuff after the path. Useful for destructuring.
Given a URL or string containing a URL, returns a vector of the three component strings: the stuff before the path, the path, and the stuff after the path. Useful for destructuring.
(up-dir path-pieces)
Given a seq of path elements as created by parse-path, returns a new seq of path elements, but having gone "up" one directory. That is, applies a ".." component to the path.
Given a seq of path elements as created by parse-path, returns a new seq of path elements, but having gone "up" one directory. That is, applies a ".." component to the path.
(url-ensure-trailing-separator url-or-string)
Behaves like ensure-trailing-separator on the path part of a URL, but takes a j.n.URL or string containing a URL, and returns a string containing the same URL instead of just a path. Everything but the path part of the URL is unchanged (query, anchor, protocol, etc).
Behaves like ensure-trailing-separator on the path part of a URL, but takes a j.n.URL or string containing a URL, and returns a string containing the same URL instead of just a path. Everything but the path part of the URL is unchanged (query, anchor, protocol, etc).
(url-normalize url-or-string)
Behaves like normalize on the path part of a URL, but takes a j.n.URL or string containing a URL, and returns a string containing the same URL instead of just a path. Everything but the path part of the URL is unchanged (query, anchor, protocol, etc).
Behaves like normalize on the path part of a URL, but takes a j.n.URL or string containing a URL, and returns a string containing the same URL instead of just a path. Everything but the path part of the URL is unchanged (query, anchor, protocol, etc).
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close