hautils

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit fcc694467fdf1313615dcad31740c96a632c1091
parent 79fba05a9edc752b115fea48fad0d90931181fe3
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sat,  8 Jan 2022 14:02:47 +0100

pwd: further improvements

Diffstat:
Mpwd.ha | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/pwd.ha b/pwd.ha @@ -52,15 +52,15 @@ fn resolvelinks(path: str) (str | fs::error) = { let iter = path::iter(path); for (true) { - let item = match (path::next(&iter)) { + const item = match (path::next(&iter)) { case let item: str => yield item; case void => break; }; - path::add(&buf, item)!; - let link = match (os::readlink(path::string(&buf))) { + const item = path::add(&buf, item)!; + const link = match (os::readlink(item)) { case let link: str => yield link; case fs::wrongtype => @@ -72,8 +72,7 @@ fn resolvelinks(path: str) (str | fs::error) = { if (!path::abs(link)) { path::add(&buf, "..", link)!; } else { - path::reset(&buf); - path::add(&buf, link)!; + path::set(&buf, link)!; }; };