Low-level file-related functions for implementing Metabase plugin functionality. These use the java.nio.file
library rather than the usual java.io
stuff because it abstracts better across different filesystems (such as
files in a normal directory vs files inside a JAR.)
As much as possible, this namespace aims to abstract away the nio.file
library and expose a set of high-level
file-manipulation functions for the sorts of operations the plugin system needs to perform.
Low-level file-related functions for implementing Metabase plugin functionality. These use the `java.nio.file` library rather than the usual `java.io` stuff because it abstracts better across different filesystems (such as files in a normal directory vs files inside a JAR.) As much as possible, this namespace aims to abstract away the `nio.file` library and expose a set of high-level *file-manipulation* functions for the sorts of operations the plugin system needs to perform.
(copy-files! source-dir dest-dir)
Copy all files in source-dir
to dest-dir
. Overwrites existing files if last modified date is older than that of
the source file.
Copy all files in `source-dir` to `dest-dir`. Overwrites existing files if last modified date is older than that of the source file.
(create-dir-if-not-exists! path)
Self-explanatory. Create a directory with path
if it does not already exist.
Self-explanatory. Create a directory with `path` if it does not already exist.
(do-with-open-path-to-resource resource f)
Impl for with-open-path-to-resource
.
Impl for `with-open-path-to-resource`.
(file-exists-in-archive? archive-path & path-components)
True is a file exists in an archive.
True is a file exists in an archive.
(files-seq path)
Get a sequence of all files in path
, presumably a directory or an archive of some sort (like a JAR).
Get a sequence of all files in `path`, presumably a directory or an archive of some sort (like a JAR).
(get-path & path-components)
Get a Path
for a file or directory in the default (i.e., system) filesystem named by string path component(s).
(get-path "/Users/cam/metabase/metabase/plugins") ;; -> #object[sun.nio.fs.UnixPath 0x4d378139 "/Users/cam/metabase/metabase/plugins"]
Get a `Path` for a file or directory in the default (i.e., system) filesystem named by string path component(s). (get-path "/Users/cam/metabase/metabase/plugins") ;; -> #object[sun.nio.fs.UnixPath 0x4d378139 "/Users/cam/metabase/metabase/plugins"]
(readable? path)
True if we can read the file at path
.
True if we can read the file at `path`.
(regular-file? path)
True if path
refers to a regular file (as opposed to something like directory).
True if `path` refers to a regular file (as opposed to something like directory).
(slurp-file-from-archive archive-path & path-components)
Read the entire contents of a file from a archive (such as a JAR).
Read the entire contents of a file from a archive (such as a JAR).
(with-open-path-to-resource [path-binding resource-filename-str] & body)
Execute body
with an Path to a resource file (i.e. a file in the project resources/
directory), cleaning up when
finished.
Throws a FileNotFoundException if the resource does not exist; be sure to check with io/resource
or similar before
calling this.
Execute `body` with an Path to a resource file (i.e. a file in the project `resources/` directory), cleaning up when finished. Throws a FileNotFoundException if the resource does not exist; be sure to check with `io/resource` or similar before calling this.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close