init commit
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
(ns filename
|
||||
"Erlang :filename module — file name manipulation.
|
||||
|
||||
In CljElixir: (filename/join [\"a\" \"b\"]), (filename/basename path), etc.
|
||||
Works with charlists (unlike Elixir's Path which uses binaries).")
|
||||
|
||||
(defn join
|
||||
"Joins path components.
|
||||
(filename/join [\"a\" \"b\" \"c\"]) ;=> 'a/b/c'
|
||||
(filename/join \"a\" \"b\") ;=> 'a/b'"
|
||||
([components])
|
||||
([name1 name2]))
|
||||
|
||||
(defn split
|
||||
"Splits a path into components.
|
||||
(filename/split \"/a/b/c\") ;=> [\"/\" \"a\" \"b\" \"c\"]"
|
||||
[name])
|
||||
|
||||
(defn basename
|
||||
"Returns the last component of the path.
|
||||
(filename/basename \"/a/b/c.txt\") ;=> 'c.txt'
|
||||
(filename/basename \"/a/b/c.txt\" \".txt\") ;=> 'c'"
|
||||
([name])
|
||||
([name ext]))
|
||||
|
||||
(defn dirname
|
||||
"Returns the directory component.
|
||||
(filename/dirname \"/a/b/c\") ;=> '/a/b'"
|
||||
[name])
|
||||
|
||||
(defn extension
|
||||
"Returns the file extension including the dot.
|
||||
(filename/extension \"file.ex\") ;=> '.ex'"
|
||||
[name])
|
||||
|
||||
(defn rootname
|
||||
"Returns path without extension.
|
||||
(filename/rootname \"file.ex\") ;=> 'file'"
|
||||
([name])
|
||||
([name ext]))
|
||||
|
||||
(defn absname
|
||||
"Converts to absolute path.
|
||||
(filename/absname \"file.txt\")"
|
||||
([name])
|
||||
([name dir]))
|
||||
|
||||
(defn flatten
|
||||
"Flattens a filename (resolves deep lists)."
|
||||
[name])
|
||||
|
||||
(defn nativename
|
||||
"Converts to native OS path format."
|
||||
[name])
|
||||
|
||||
(defn pathtype
|
||||
"Returns path type: :absolute, :relative, or :volumerelative.
|
||||
(filename/pathtype \"/a/b\") ;=> :absolute"
|
||||
[name])
|
||||
|
||||
(defn safe-relative-path
|
||||
"Returns a safe relative path or :unsafe."
|
||||
[name])
|
||||
|
||||
(defn find-src
|
||||
"Finds source file from object file name."
|
||||
([beam])
|
||||
([beam rules]))
|
||||
|
||||
(defn find-file
|
||||
"Finds a file in the given paths."
|
||||
([name paths])
|
||||
([name paths extensions]))
|
||||
Reference in New Issue
Block a user