hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit f33b520e97ba15ba8b06732eb0e3b388ecaa871b
parent b2bd020bb0a7c19af91b982c80ea1268e4572f21
Author: Drew DeVault <sir@cmpwn.com>
Date:   Wed, 21 Apr 2021 12:28:03 -0400

path: improve docs

Diffstat:
Apath/README | 5+++++
Mpath/iter.ha | 3+--
Mpath/names.ha | 6+++---
3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/path/README b/path/README @@ -0,0 +1,5 @@ +The path module provides utilities for working with filesystem paths. + +Note that Hare expects paths to be valid UTF-8 strings. If you require the use +of non-UTF-8 paths (ideally for only as long as it takes to delete or rename +those files), see the low-level functions available from [[rt]]. diff --git a/path/iter.ha b/path/iter.ha @@ -6,7 +6,6 @@ export type iflags = enum uint { ABSOLUTE = 1 << 0, }; -// An iterator which yields each component of a path. export type iterator = struct { tok: bytes::tokenizer, flags: iflags, @@ -15,7 +14,7 @@ export type iterator = struct { let pathsep: []u8 = [PATHSEP]; // Returns an iterator which yields each component of a path. If the path is -// absolute, the first component will be the root path (e.g. /). +// absolute, the first component will be the root path (e.g. "/"). export fn iter(path: str) iterator = { let flags = iflags::NONE; let pb = strings::toutf8(path); diff --git a/path/names.ha b/path/names.ha @@ -52,9 +52,9 @@ export fn basename(path: str) str = { // // The extension includes the '.' character. // -// extension("foo/example") => ("example", "") -// extension("foo/example.txt") => ("example", ".txt") -// extension("foo/example.tar.gz") => ("example", ".tar.gz") +// extension("foo/example") => ("example", "") +// extension("foo/example.txt") => ("example", ".txt") +// extension("foo/example.tar.gz") => ("example", ".tar.gz") export fn extension(p: str) (str, str) = { let p = basename(p); let b = strings::toutf8(p);