You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/stdlib.dgn.md
+58Lines changed: 58 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1195,6 +1195,64 @@ Returns the absolute path of `path`, rooted at `root` (which must be absolute; d
1195
1195
Expands `~` or a path starting with `~/` to a full path, replacing `~` with getHomeDir() (otherwise returns `path` unmodified). Windows: this is still supported despite the Windows platform not having this convention.
1196
1196
1197
1197
1198
+
### dirs
1199
+
1200
+
@../lib/std/dirs.nim
1201
+
1202
+
This module implements operations for creating, removing, and iterating over directories.
1203
+
1204
+
1205
+
####tryCreateFinalDir
1206
+
1207
+
Tries to create the final directory in a path. In other words, it tries to create a single new directory, not a nested one. It returns the OS's error code making it easy to distinguish between "could not create" and "already exists".
1208
+
1209
+
####createDir
1210
+
1211
+
Creates a new directory `dir`. If the directory already exists, no error is raised. This can be used to create a nested directory structure directly.
1212
+
1213
+
####tryRemoveFinalDir
1214
+
1215
+
Tries to remove the final directory in a path. In other words, it tries to remove a single directory, not a nested one. It returns the OS's error code making it easy to distinguish between "could not remove" and "does not exist".
1216
+
1217
+
####removeDir
1218
+
1219
+
Removes the directory `dir`. If the directory does not exist, no error is raised.
1220
+
1221
+
1222
+
####tryRemoveFile
1223
+
1224
+
Tries to remove the file. It returns the OS's error code making it easy to distinguish between "could not remove" and "does not exist".
1225
+
1226
+
####removeFile
1227
+
1228
+
Removes the file `file`. If the file did not exist, no error is raised.
1229
+
1230
+
1231
+
####walkDir
1232
+
1233
+
Walks over all entries in the directory `dir`.
1234
+
1235
+
Yields tuples of `(kind, path)` where `kind` is one of:
1236
+
-`pcFile` - regular file
1237
+
-`pcDir` - directory
1238
+
-`pcLinkToFile` - symbolic link to a file
1239
+
-`pcLinkToDir` - symbolic link to a directory
1240
+
1241
+
If `relative` is true, yields relative paths (just the filename/dirname), otherwise yields full paths.
1242
+
1243
+
If `checkDir` is true, raises an error if `dir` doesn't exist or isn't a directory.
1244
+
1245
+
Special directories "." and ".." are skipped.
1246
+
1247
+
1248
+
####getCurrentDir
1249
+
Returns the current working directory as a `Path`. Raises an error if unable to retrieve the current directory.
1250
+
1251
+
####setCurrentDir
1252
+
Sets the current working directory to `dir`. Raises an error if the directory does not exist or lacks permissions.
0 commit comments