Skip to content

Commit fb5e863

Browse files
authored
improve docs #266
1 parent e4be9ab commit fb5e863

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

platform/File.roc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ readUtf8 = \path ->
153153
# Path.read (Path.fromStr path) fmt
154154

155155
## Returns true if the path exists on disk and is pointing at a directory.
156-
## Any error will return false.
156+
## Returns `Task.ok false` if the path exists and it is not a directory. If the path does not exist,
157+
## this function will return `Task.err PathErr PathDoesNotExist`.
158+
##
157159
## This uses [rust's std::path::is_dir](https://doc.rust-lang.org/std/path/struct.Path.html#method.is_dir).
158160
##
159161
## > [Path.isDir] does the same thing, except it takes a [Path] instead of a [Str].
@@ -162,7 +164,9 @@ isDir = \path ->
162164
Path.isDir (Path.fromStr path)
163165

164166
## Returns true if the path exists on disk and is pointing at a regular file.
165-
## Any error will return false.
167+
## Returns `Task.ok false` if the path exists and it is not a file. If the path does not exist,
168+
## this function will return `Task.err PathErr PathDoesNotExist`.
169+
##
166170
## This uses [rust's std::path::is_file](https://doc.rust-lang.org/std/path/struct.Path.html#method.is_file).
167171
##
168172
## > [Path.isFile] does the same thing, except it takes a [Path] instead of a [Str].
@@ -171,7 +175,9 @@ isFile = \path ->
171175
Path.isFile (Path.fromStr path)
172176

173177
## Returns true if the path exists on disk and is pointing at a symbolic link.
174-
## Any error will return false.
178+
## Returns `Task.ok false` if the path exists and it is not a symbolic link. If the path does not exist,
179+
## this function will return `Task.err PathErr PathDoesNotExist`.
180+
##
175181
## This uses [rust's std::path::is_symlink](https://doc.rust-lang.org/std/path/struct.Path.html#method.is_symlink).
176182
##
177183
## > [Path.isSymLink] does the same thing, except it takes a [Path] instead of a [Str].

platform/Path.roc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,10 @@ display = \path ->
418418
# Path.isDir, etc.
419419

420420
## Returns true if the path exists on disk and is pointing at a directory.
421-
## Any error will return false.
421+
## Returns `Task.ok false` if the path exists and it is not a directory. If the path does not exist,
422+
## this function will return `Task.err PathErr PathDoesNotExist`.
423+
##
424+
## This uses [rust's std::path::is_dir](https://doc.rust-lang.org/std/path/struct.Path.html#method.is_dir).
422425
##
423426
## > [`File.isDir`](File#isDir) does the same thing, except it takes a [Str] instead of a [Path].
424427
isDir : Path -> Task Bool [PathErr MetadataErr]
@@ -427,7 +430,9 @@ isDir = \path ->
427430
Task.ok (res == IsDir)
428431

429432
## Returns true if the path exists on disk and is pointing at a regular file.
430-
## Any error will return false.
433+
## Returns `Task.ok false` if the path exists and it is not a file. If the path does not exist,
434+
## this function will return `Task.err PathErr PathDoesNotExist`.
435+
##
431436
## This uses [rust's std::path::is_file](https://doc.rust-lang.org/std/path/struct.Path.html#method.is_file).
432437
##
433438
## > [`File.isFile`](File#isFile) does the same thing, except it takes a [Str] instead of a [Path].
@@ -437,7 +442,10 @@ isFile = \path ->
437442
Task.ok (res == IsFile)
438443

439444
## Returns true if the path exists on disk and is pointing at a symbolic link.
440-
## Any error will return false.
445+
## Returns `Task.ok false` if the path exists and it is not a symbolic link. If the path does not exist,
446+
## this function will return `Task.err PathErr PathDoesNotExist`.
447+
##
448+
## This uses [rust's std::path::is_symlink](https://doc.rust-lang.org/std/path/struct.Path.html#method.is_symlink).
441449
##
442450
## > [`File.isSymLink`](File#isSymLink) does the same thing, except it takes a [Str] instead of a [Path].
443451
isSymLink : Path -> Task Bool [PathErr MetadataErr]

0 commit comments

Comments
 (0)