hare

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

commit 53a227d5093beb51c27cfd29189b6f72beb40109
parent 1869493083551f615c9490910d79aff0e07277bc
Author: Sebastian <sebastian@sebsite.pw>
Date:   Tue, 10 Jan 2023 23:39:44 -0500

os: add link and symlink

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Mos/fs.ha | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/os/fs.ha b/os/fs.ha @@ -70,6 +70,13 @@ export fn resolve(path: str) str = fs::resolve(cwd, path); // statically allocated and will be overwritten on subsequent calls. export fn readlink(path: str) (str | fs::error) = fs::readlink(cwd, path); +// Creates a new (hard) link at 'new' for the file at 'old'. +export fn link(old: str, new: str) (void | fs::error) = fs::link(cwd, old, new); + +// Creates a new symbolic link at 'path' which points to 'target'. +export fn symlink(target: str, path: str) (void | fs::error) = + fs::symlink(cwd, target, path); + // Opens a file. // // If no flags are provided, [[fs::flags::RDONLY]] is used when opening the