aboutsummaryrefslogtreecommitdiff
path: root/man/man3/tomo-Path.3
blob: f383196ea30b0bd0edad7fe5dc6449b6725d10c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH Path 3 2025-11-29 "Tomo man-pages"
.SH NAME
Path \- a Tomo type
.SH LIBRARY
Tomo Standard Library
.fi
.SH METHODS

.TP
.BI Path.accessed\ :\ func(path:\ Path,\ follow_symlinks:\ Bool\ =\ yes\ ->\ Int64?)
Gets the file access time of a file. 

For more, see:
.BR Tomo-Path.accessed (3)


.TP
.BI Path.append\ :\ func(path:\ Path,\ text:\ Text,\ permissions:\ Int32\ =\ Int32(0o644)\ ->\ Void)
Appends the given text to the file at the specified path, creating the file if it doesn't already exist. Failure to write will result in a runtime error. 

For more, see:
.BR Tomo-Path.append (3)


.TP
.BI Path.append_bytes\ :\ func(path:\ Path,\ bytes:\ [Byte],\ permissions:\ Int32\ =\ Int32(0o644)\ ->\ Void)
Appends the given bytes to the file at the specified path, creating the file if it doesn't already exist. Failure to write will result in a runtime error. 

For more, see:
.BR Tomo-Path.append_bytes (3)


.TP
.BI Path.base_name\ :\ func(path:\ Path\ ->\ Text)
Returns the base name of the file or directory at the specified path. 

For more, see:
.BR Tomo-Path.base_name (3)


.TP
.BI Path.by_line\ :\ func(path:\ Path\ ->\ func(->Text?)?)
Returns an iterator that can be used to iterate over a file one line at a time, or returns none if the file could not be opened. 

For more, see:
.BR Tomo-Path.by_line (3)


.TP
.BI Path.can_execute\ :\ func(path:\ Path\ ->\ Bool)
Returns whether or not a file can be executed by the current user/group. 

For more, see:
.BR Tomo-Path.can_execute (3)


.TP
.BI Path.can_read\ :\ func(path:\ Path\ ->\ Bool)
Returns whether or not a file can be read by the current user/group. 

For more, see:
.BR Tomo-Path.can_read (3)


.TP
.BI Path.can_write\ :\ func(path:\ Path\ ->\ Bool)
Returns whether or not a file can be written by the current user/group. 

For more, see:
.BR Tomo-Path.can_write (3)


.TP
.BI Path.changed\ :\ func(path:\ Path,\ follow_symlinks:\ Bool\ =\ yes\ ->\ Int64?)
Gets the file change time of a file. 

For more, see:
.BR Tomo-Path.changed (3)


.TP
.BI Path.child\ :\ func(path:\ Path,\ child:\ Text\ ->\ Path)
Return a path that is a child of another path. 

For more, see:
.BR Tomo-Path.child (3)


.TP
.BI Path.children\ :\ func(path:\ Path,\ include_hidden\ =\ no\ ->\ [Path])
Returns a list of children (files and directories) within the directory at the specified path. Optionally includes hidden files. 

For more, see:
.BR Tomo-Path.children (3)


.TP
.BI Path.create_directory\ :\ func(path:\ Path,\ permissions\ =\ Int32(0o755),\ recursive\ =\ yes\ ->\ Void)
Creates a new directory at the specified path with the given permissions. If any of the parent directories do not exist, they will be created as needed. 

For more, see:
.BR Tomo-Path.create_directory (3)


.TP
.BI Path.current_dir\ :\ func(->\ Path)
Creates a new directory at the specified path with the given permissions. If any of the parent directories do not exist, they will be created as needed. 

For more, see:
.BR Tomo-Path.current_dir (3)


.TP
.BI Path.exists\ :\ func(path:\ Path\ ->\ Bool)
Checks if a file or directory exists at the specified path. 

For more, see:
.BR Tomo-Path.exists (3)


.TP
.BI Path.expand_home\ :\ func(path:\ Path\ ->\ Path)
For home-based paths (those starting with \fB~\fR), expand the path to replace the tilde with and absolute path to the user's \fB$HOME\fR directory. 

For more, see:
.BR Tomo-Path.expand_home (3)


.TP
.BI Path.extension\ :\ func(path:\ Path,\ full:\ Bool\ =\ yes\ ->\ Text)
Returns the file extension of the file at the specified path. Optionally returns the full extension. 

For more, see:
.BR Tomo-Path.extension (3)


.TP
.BI Path.files\ :\ func(path:\ Path,\ include_hidden:\ Bool\ =\ no\ ->\ [Path])
Returns a list of files within the directory at the specified path. Optionally includes hidden files. 

For more, see:
.BR Tomo-Path.files (3)


.TP
.BI Path.from_components\ :\ func(components:\ [Text]\ ->\ Path)
Returns a path built from a list of path components. 

For more, see:
.BR Tomo-Path.from_components (3)


.TP
.BI Path.glob\ :\ func(path:\ Path\ ->\ [Path])
Perform a globbing operation and return a list of matching paths. Some glob specific details: - The paths "." and ".." are *not* included in any globbing results. - Files or directories that begin with "." will not match \fB*\fR, but will match \fB.*\fR. - Globs do support \fB{a,b}\fR syntax for matching files that match any of several   choices of patterns.  - The shell-style syntax \fB**\fR for matching subdirectories is not supported. 

For more, see:
.BR Tomo-Path.glob (3)


.TP
.BI Path.group\ :\ func(path:\ Path,\ follow_symlinks:\ Bool\ =\ yes\ ->\ Text?)
Get the owning group of a file or directory. 

For more, see:
.BR Tomo-Path.group (3)


.TP
.BI Path.has_extension\ :\ func(path:\ Path,\ extension:\ Text\ ->\ Bool)
Return whether or not a path has a given file extension. 

For more, see:
.BR Tomo-Path.has_extension (3)


.TP
.BI Path.is_directory\ :\ func(path:\ Path,\ follow_symlinks\ =\ yes\ ->\ Bool)
Checks if the path represents a directory. Optionally follows symbolic links. 

For more, see:
.BR Tomo-Path.is_directory (3)


.TP
.BI Path.is_file\ :\ func(path:\ Path,\ follow_symlinks\ =\ yes\ ->\ Bool)
Checks if the path represents a file. Optionally follows symbolic links. 

For more, see:
.BR Tomo-Path.is_file (3)


.TP
.BI Path.is_socket\ :\ func(path:\ Path,\ follow_symlinks\ =\ yes\ ->\ Bool)
Checks if the path represents a socket. Optionally follows symbolic links. 

For more, see:
.BR Tomo-Path.is_socket (3)


.TP
.BI Path.is_symlink\ :\ func(path:\ Path\ ->\ Bool)
Checks if the path represents a symbolic link. 

For more, see:
.BR Tomo-Path.is_symlink (3)


.TP
.BI Path.lines\ :\ func(path:\ Path\ ->\ [Text]?)
Returns a list with the lines of text in a file or returns none if the file could not be opened. 

For more, see:
.BR Tomo-Path.lines (3)


.TP
.BI Path.modified\ :\ func(path:\ Path,\ follow_symlinks:\ Bool\ =\ yes\ ->\ Int64?)
Gets the file modification time of a file. 

For more, see:
.BR Tomo-Path.modified (3)


.TP
.BI Path.owner\ :\ func(path:\ Path,\ follow_symlinks:\ Bool\ =\ yes\ ->\ Text?)
Get the owning user of a file or directory. 

For more, see:
.BR Tomo-Path.owner (3)


.TP
.BI Path.parent\ :\ func(path:\ Path\ ->\ Path)
Returns the parent directory of the file or directory at the specified path. 

For more, see:
.BR Tomo-Path.parent (3)


.TP
.BI Path.read\ :\ func(path:\ Path\ ->\ Text?)
Reads the contents of the file at the specified path or none if the file could not be read. 

For more, see:
.BR Tomo-Path.read (3)


.TP
.BI Path.read_bytes\ :\ func(path:\ Path,\ limit:\ Int?\ =\ none\ ->\ [Byte]?)
Reads the contents of the file at the specified path or none if the file could not be read. 

For more, see:
.BR Tomo-Path.read_bytes (3)


.TP
.BI Path.relative_to\ :\ func(path:\ Path,\ relative_to\ =\ (./)\ ->\ Path)
Returns the path relative to a given base path. By default, the base path is the current directory. 

For more, see:
.BR Tomo-Path.relative_to (3)


.TP
.BI Path.remove\ :\ func(path:\ Path,\ ignore_missing\ =\ no\ ->\ Void)
Removes the file or directory at the specified path. A runtime error is raised if something goes wrong. 

For more, see:
.BR Tomo-Path.remove (3)


.TP
.BI Path.resolved\ :\ func(path:\ Path,\ relative_to\ =\ (./)\ ->\ Path)
Resolves the absolute path of the given path relative to a base path. By default, the base path is the current directory. 

For more, see:
.BR Tomo-Path.resolved (3)


.TP
.BI Path.set_owner\ :\ func(path:\ Path,\ owner:\ Text?\ =\ none,\ group:\ Text?\ =\ none,\ follow_symlinks:\ Bool\ =\ yes\ ->\ Void)
Set the owning user and/or group for a path. 

For more, see:
.BR Tomo-Path.set_owner (3)


.TP
.BI Path.sibling\ :\ func(path:\ Path,\ name:\ Text\ ->\ Path)
Return a path that is a sibling of another path (i.e. has the same parent, but a different name). This is equivalent to \fB.parent().child(name)\fR 

For more, see:
.BR Tomo-Path.sibling (3)


.TP
.BI Path.subdirectories\ :\ func(path:\ Path,\ include_hidden\ =\ no\ ->\ [Path])
Returns a list of subdirectories within the directory at the specified path. Optionally includes hidden subdirectories. 

For more, see:
.BR Tomo-Path.subdirectories (3)


.TP
.BI Path.unique_directory\ :\ func(path:\ Path\ ->\ Path)
Generates a unique directory path based on the given path. Useful for creating temporary directories. 

For more, see:
.BR Tomo-Path.unique_directory (3)


.TP
.BI Path.write\ :\ func(path:\ Path,\ text:\ Text,\ permissions\ =\ Int32(0o644)\ ->\ Void)
Writes the given text to the file at the specified path, creating the file if it doesn't already exist. Sets the file permissions as specified. If the file writing cannot be successfully completed, a runtime error is raised. 

For more, see:
.BR Tomo-Path.write (3)


.TP
.BI Path.write_bytes\ :\ func(path:\ Path,\ bytes:\ [Byte],\ permissions\ =\ Int32(0o644)\ ->\ Void)
Writes the given bytes to the file at the specified path, creating the file if it doesn't already exist. Sets the file permissions as specified. If the file writing cannot be successfully completed, a runtime error is raised. 

For more, see:
.BR Tomo-Path.write_bytes (3)


.TP
.BI Path.write_unique\ :\ func(path:\ Path,\ text:\ Text\ ->\ Path)
Writes the given text to a unique file path based on the specified path. The file is created if it doesn't exist. This is useful for creating temporary files. 

For more, see:
.BR Tomo-Path.write_unique (3)


.TP
.BI Path.write_unique_bytes\ :\ func(path:\ Path,\ bytes:\ [Byte]\ ->\ Path)
Writes the given bytes to a unique file path based on the specified path. The file is created if it doesn't exist. This is useful for creating temporary files. 

For more, see:
.BR Tomo-Path.write_unique_bytes (3)