1
- (ns
2
- ^{:go-imports ["path/filepath"]
3
- :doc "Implements utility routines for manipulating filename paths."}
1
+ (ns ^{:go-imports ["path/filepath"]
2
+ :doc "Implements utility routines for manipulating filename paths."}
4
3
filepath)
5
4
6
5
(defn file-seq
7
6
"Returns a seq of maps with info about files or directories under root."
8
7
{:added "1.0"
9
- :go "fileSeq(root)"}
8
+ :go "fileSeq(root)"}
10
9
[^String root])
11
10
12
11
(defn ^String abs
15
14
The absolute path name for a given file is not guaranteed to be unique.
16
15
Calls clean on the result."
17
16
{:added "1.0"
18
- :go "! _res, err := filepath.Abs(path); PanicOnErr(err)"}
17
+ :go "! _res, err := filepath.Abs(path); PanicOnErr(err)"}
19
18
[^String path])
20
19
21
20
(defn ^String base
22
21
"Returns the last element of path. Trailing path separators are removed before
23
22
extracting the last element. If the path is empty, returns \".\". If the path consists
24
23
entirely of separators, returns a single separator."
25
24
{:added "1.0"
26
- :go "filepath.Base(path)"}
25
+ :go "filepath.Base(path)"}
27
26
[^String path])
28
27
29
28
(defn ^String clean
@@ -43,7 +42,7 @@ Finally, any occurrences of slash are replaced by separator.
43
42
44
43
If the result of this process is an empty string, returns the string \".\"."
45
44
{:added "1.0"
46
- :go "filepath.Clean(path)"}
45
+ :go "filepath.Clean(path)"}
47
46
[^String path])
48
47
49
48
(defn ^String dir
@@ -52,29 +51,29 @@ If the result of this process is an empty string, returns the string \".\"."
52
51
If the path is empty, returns \".\". If the path consists entirely of separators,
53
52
returns a single separator. The returned path does not end in a separator unless it is the root directory."
54
53
{:added "1.0"
55
- :go "filepath.Dir(path)"}
54
+ :go "filepath.Dir(path)"}
56
55
[^String path])
57
56
58
57
(defn ^String eval-symlinks
59
58
"Returns the path name after the evaluation of any symbolic links. If path is relative the result will be
60
59
relative to the current directory, unless one of the components is an absolute symbolic link.
61
60
Calls clean on the result."
62
61
{:added "1.0"
63
- :go "! _res, err := filepath.EvalSymlinks(path); PanicOnErr(err)"}
62
+ :go "! _res, err := filepath.EvalSymlinks(path); PanicOnErr(err)"}
64
63
[^String path])
65
64
66
65
(defn ^String ext
67
66
"Returns the file name extension used by path. The extension is the suffix beginning at the final dot
68
67
in the final element of path; it is empty if there is no dot."
69
68
{:added "1.0"
70
- :go "filepath.Ext(path)"}
69
+ :go "filepath.Ext(path)"}
71
70
[^String path])
72
71
73
72
(defn ^String from-slash
74
73
"Returns the result of replacing each slash ('/') character in path with a separator character.
75
74
Multiple slashes are replaced by multiple separators."
76
75
{:added "1.0"
77
- :go "filepath.FromSlash(path)"}
76
+ :go "filepath.FromSlash(path)"}
78
77
[^String path])
79
78
80
79
(defn ^{:tag [String]} glob
@@ -85,21 +84,21 @@ If the result of this process is an empty string, returns the string \".\"."
85
84
Ignores file system errors such as I/O errors reading directories.
86
85
Throws exception when pattern is malformed."
87
86
{:added "1.0"
88
- :go "! _res, err := filepath.Glob(pattern); PanicOnErr(err)"}
87
+ :go "! _res, err := filepath.Glob(pattern); PanicOnErr(err)"}
89
88
[^String pattern])
90
89
91
90
(defn ^Boolean abs?
92
91
"Reports whether the path is absolute."
93
92
{:added "1.0"
94
- :go "filepath.IsAbs(path)"}
93
+ :go "filepath.IsAbs(path)"}
95
94
[^String path])
96
95
97
96
(defn ^String join
98
97
"Joins any number of path elements into a single path, adding a separator if necessary.
99
98
Calls clean on the result; in particular, all empty strings are ignored. On Windows,
100
99
the result is a UNC path if and only if the first path element is a UNC path."
101
100
{:added "1.0"
102
- :go "filepath.Join(elems...)"}
101
+ :go "filepath.Join(elems...)"}
103
102
[& ^String elems])
104
103
105
104
(defn ^Boolean matches?
@@ -108,7 +107,7 @@ If the result of this process is an empty string, returns the string \".\"."
108
107
Throws exception if pattern is malformed.
109
108
On Windows, escaping is disabled. Instead, '\\' is treated as path separator."
110
109
{:added "1.0"
111
- :go "! _res, err := filepath.Match(pattern, name); PanicOnErr(err)"}
110
+ :go "! _res, err := filepath.Match(pattern, name); PanicOnErr(err)"}
112
111
[^String pattern ^String name])
113
112
114
113
(defn ^String rel
@@ -118,50 +117,48 @@ If the result of this process is an empty string, returns the string \".\"."
118
117
relative to basepath or if knowing the current working directory would be necessary to compute it.
119
118
Calls clean on the result."
120
119
{:added "1.0"
121
- :go "! _res, err := filepath.Rel(basepath, targpath); PanicOnErr(err)"}
120
+ :go "! _res, err := filepath.Rel(basepath, targpath); PanicOnErr(err)"}
122
121
[^String basepath ^String targpath])
123
122
124
123
(defn split
125
124
"Splits path immediately following the final separator, separating it into a directory and file name component.
126
125
If there is no separator in path, returns an empty dir and file set to path. The returned values have
127
126
the property that path = dir+file."
128
127
{:added "1.0"
129
- :go "! _dir, _file := filepath.Split(path); _res := NewVectorFrom(MakeString(_dir), MakeString(_file))"}
128
+ :go "! _dir, _file := filepath.Split(path); _res := NewVectorFrom(MakeString(_dir), MakeString(_file))"}
130
129
[^String path])
131
130
132
131
(defn ^{:tag [String]} split-list
133
132
"Splits a list of paths joined by the OS-specific list-separator, usually found in PATH or GOPATH environment variables.
134
133
Returns an empty slice when passed an empty string."
135
134
{:added "1.0"
136
- :go "filepath.SplitList(path)"}
135
+ :go "filepath.SplitList(path)"}
137
136
[^String path])
138
137
139
138
(defn ^String to-slash
140
139
"Returns the result of replacing each separator character in path with a slash ('/') character.
141
140
Multiple separators are replaced by multiple slashes."
142
141
{:added "1.0"
143
- :go "filepath.ToSlash(path)"}
142
+ :go "filepath.ToSlash(path)"}
144
143
[^String path])
145
144
146
145
(defn ^String volume-name
147
146
"Returns leading volume name. Given \"C:\\foo\\bar\" it returns \"C:\" on Windows. Given \"\\\\host\\share\\foo\"
148
147
returns \"\\\\host\\share\". On other platforms it returns \"\"."
149
148
{:added "1.0"
150
- :go "filepath.VolumeName(path)"}
149
+ :go "filepath.VolumeName(path)"}
151
150
[^String path])
152
151
153
- (def
154
- ^{:doc "OS-specific path separator."
155
- :added "1.0"
156
- :tag String
157
- :const true
158
- :go "string(filepath.Separator)"}
152
+ (def ^{:doc "OS-specific path separator."
153
+ :added "1.0"
154
+ :tag String
155
+ :const true
156
+ :go "string(filepath.Separator)"}
159
157
separator)
160
158
161
- (def
162
- ^{:doc "OS-specific path list separator."
163
- :added "1.0"
164
- :tag String
165
- :const true
166
- :go "string(filepath.ListSeparator)"}
159
+ (def ^{:doc "OS-specific path list separator."
160
+ :added "1.0"
161
+ :tag String
162
+ :const true
163
+ :go "string(filepath.ListSeparator)"}
167
164
list-separator)
0 commit comments