hare

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

commit 57a61e79a10f1e18a7ab366adc33db7f2ecb636b
parent ff57b84b1c4d7737d9ae40f2f7d85c446999a251
Author: Sebastian <sebastian@sebsite.pw>
Date:   Thu, 31 Aug 2023 02:11:56 -0400

dirs: remove *fs functions

Also get rid of an unused import while here

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

Diffstat:
Mdirs/xdg.ha | 15---------------
Mscripts/gen-stdlib | 2+-
Mstdlib.mk | 4++--
3 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/dirs/xdg.ha b/dirs/xdg.ha @@ -9,7 +9,6 @@ use fmt; use fs; use os; use path; -use io; use unix; fn lookup(prog: str, var: str, default: str) str = { @@ -51,19 +50,12 @@ fn lookup(prog: str, var: str, default: str) str = { // function in the dirs module. export fn config(prog: str) str = lookup(prog, "XDG_CONFIG_HOME", ".config"); -// Returns an [[fs::fs]] for storing config files. The "prog" parameter -// should be a descriptive name unique to this program. -export fn configfs(prog: str) *fs::fs = os::diropen(config(prog)) as *fs::fs; - // Returns a directory suitable for cache files. The "prog" parameter should be // a descriptive name unique to this program. The return value is statically // allocated and will be overwritten on subsequent calls to any function in the // dirs module. export fn cache(prog: str) str = lookup(prog, "XDG_CACHE_HOME", ".cache"); -// Returns an [[fs::fs]] for cache files. -export fn cachefs(prog: str) *fs::fs = os::diropen(cache(prog)) as *fs::fs; - // Returns a directory suitable for persistent data files. The "prog" parameter // should be a descriptive name unique to this program. The return value is // statically allocated and will be overwritten on subsequent calls to any @@ -74,10 +66,6 @@ export fn data(prog: str) str = { return lookup(prog, "XDG_DATA_HOME", fragment); }; -// Returns an [[fs::fs]] for persistent data files. If "prog" is given, a unique -// path for this program to store data will be returned. -export fn datafs(prog: str) *fs::fs = os::diropen(data(prog)) as *fs::fs; - // Returns a directory suitable for storing program state data. The "prog" // parameter should be a descriptive name unique to this program. The return // value is statically allocated and will be overwritten on subsequent calls to @@ -88,9 +76,6 @@ export fn state(prog: str) str = { return lookup(prog, "XDG_STATE_HOME", fragment); }; -// Returns an [[fs::fs]] for storing program state data. -export fn statefs(prog: str) *fs::fs = os::diropen(state(prog)) as *fs::fs; - // Returns a directory suitable for storing non-essential runtime files and // other file objects (such as sockets, named pipes, and so on). Applications // should use this directory for communication and synchronization purposes and diff --git a/scripts/gen-stdlib b/scripts/gen-stdlib @@ -589,7 +589,7 @@ datetime() { dirs() { gen_srcs dirs \ xdg.ha - gen_ssa dirs errors fs io os path fmt unix + gen_ssa dirs errors fs os path fmt unix } encoding_base64() { diff --git a/stdlib.mk b/stdlib.mk @@ -1219,7 +1219,7 @@ $(HARECACHE)/crypto/x25519/crypto_x25519-any.ssa: $(stdlib_crypto_x25519_any_src stdlib_dirs_any_srcs = \ $(STDLIB)/dirs/xdg.ha -$(HARECACHE)/dirs/dirs-any.ssa: $(stdlib_dirs_any_srcs) $(stdlib_rt) $(stdlib_errors_$(PLATFORM)) $(stdlib_fs_$(PLATFORM)) $(stdlib_io_$(PLATFORM)) $(stdlib_os_$(PLATFORM)) $(stdlib_path_$(PLATFORM)) $(stdlib_fmt_$(PLATFORM)) $(stdlib_unix_$(PLATFORM)) +$(HARECACHE)/dirs/dirs-any.ssa: $(stdlib_dirs_any_srcs) $(stdlib_rt) $(stdlib_errors_$(PLATFORM)) $(stdlib_fs_$(PLATFORM)) $(stdlib_os_$(PLATFORM)) $(stdlib_path_$(PLATFORM)) $(stdlib_fmt_$(PLATFORM)) $(stdlib_unix_$(PLATFORM)) @printf 'HAREC \t$@\n' @mkdir -p $(HARECACHE)/dirs @$(stdlib_env) $(HAREC) $(HAREFLAGS) -o $@ -Ndirs \ @@ -3654,7 +3654,7 @@ $(TESTCACHE)/crypto/x25519/crypto_x25519-any.ssa: $(testlib_crypto_x25519_any_sr testlib_dirs_any_srcs = \ $(STDLIB)/dirs/xdg.ha -$(TESTCACHE)/dirs/dirs-any.ssa: $(testlib_dirs_any_srcs) $(testlib_rt) $(testlib_errors_$(PLATFORM)) $(testlib_fs_$(PLATFORM)) $(testlib_io_$(PLATFORM)) $(testlib_os_$(PLATFORM)) $(testlib_path_$(PLATFORM)) $(testlib_fmt_$(PLATFORM)) $(testlib_unix_$(PLATFORM)) +$(TESTCACHE)/dirs/dirs-any.ssa: $(testlib_dirs_any_srcs) $(testlib_rt) $(testlib_errors_$(PLATFORM)) $(testlib_fs_$(PLATFORM)) $(testlib_os_$(PLATFORM)) $(testlib_path_$(PLATFORM)) $(testlib_fmt_$(PLATFORM)) $(testlib_unix_$(PLATFORM)) @printf 'HAREC \t$@\n' @mkdir -p $(TESTCACHE)/dirs @$(testlib_env) $(HAREC) $(TESTHAREFLAGS) -o $@ -Ndirs \