io.randomseed.utils.fs
added in 1.0.0
Random utils, filesystem utilities.
get-java-classpath-folders
(get-java-classpath-folders)
Lists all directories the exist in Java classpath as a sequence of strings. Returns nil if there are none.
home-dir-pathname
(home-dir-pathname)
(home-dir-pathname & paths)
For the given pathnames creates a pathname expressed as a string by prefixing them with user’s home directory obtained from the Java property user.dir
with all parts joined using current path name separator.
prop-pathname
(prop-pathname prop)
(prop-pathname prop paths)
For the given Java property name and optional path names creates a path name expressed as a string by prefixing them with the directory obtained from a property with all parts joined using pathname separator.
read-lines
(read-lines filename)
(read-lines n filename)
Read first n lines from a file. If the pathname is relative it will be relative to user’s home directory.
read-preferences
(read-preferences filename)
Reads the given preferences file. If the path is relative it will be relative to user’s home directory.
resource-file
(resource-file resource)
Returns a java.io.File object for the existing resource of the given name.
resource-pathname
(resource-pathname)
(resource-pathname & paths)
For the given pathnames creates a pathname expressed as a string which resides within one of the Java resource directories. The path must exist to be returned.
user-dir-pathname
(user-dir-pathname)
(user-dir-pathname & paths)
For the given pathnames creates a pathname expressed as a string by prefixing them with user’s directory (typically a project directory) obtained from the Java property user.dir
with all parts joined using current path name separator.
with-ns-loading
(with-ns-loading op k & more)
(with-ns-loading k)
Executes the given function op and passes it a key or a sequence given as k and additional, optional arguments. Before that happens it will get all identifiers from the sequence (or check if the given single k is an identifier) and try to load their namespaces if the identifier(s) is/are fully qualified.
write-preferences
(write-preferences filename data)
Writes the given preference file. If the path is relative it will be relative to user’s home directory.