My agentic slop goes here. Not intended for anyone else!

wip

Changed files
+13 -19
toru
+10 -12
toru/lib/toru/cache.ml
···
base_path : Eio.Fs.dir_ty Eio.Path.t;
version : string option;
sw : Eio.Switch.t;
-
env : Eio_unix.Stdenv.base;
}
-
let rec create ~sw ~env ?version path_str =
-
let base_path = Eio.Path.(env#fs / path_str) in
-
{ base_path; version; sw; env }
-
-
and default ~sw ~env ?app_name () =
+
let rec create ~sw ~fs ?app_name ?version path_str =
let app_name = Option.value app_name ~default:"toru" in
-
let path_str = default_cache_path ~app_name () in
-
create ~sw ~env path_str
+
let xdg_dirs = Xdg.create ~env:Sys.getenv_opt () in
+
let cache_dir = Xdg.cache_dir xdg_dirs in
+
Filename.concat cache_dir app_name
+
let base_path = Eio.Path.(fs / path_str) in
+
{ base_path; version; sw }
+
+
and default ~sw ?app_name () =
+
create ~sw path_str
and default_cache_path ?app_name () =
let app_name = Option.value app_name ~default:"toru" in
(* Use the official xdg package for XDG Base Directory Specification *)
-
let xdg_dirs = Xdg.create ~env:Sys.getenv_opt () in
-
let cache_dir = Xdg.cache_dir xdg_dirs in
-
Filename.concat cache_dir app_name
let base_path t = t.base_path
let version t = t.version
···
let version_str = Option.fold t.version ~none:"no version"
~some:(fun v -> "version " ^ v) in
Format.fprintf fmt "Cache at %s (%s)"
-
(Eio.Path.native_exn t.base_path) version_str
+
(Eio.Path.native_exn t.base_path) version_str
+2 -6
toru/lib/toru/cache.mli
···
(** {1 Construction} *)
(** Create cache with explicit path *)
-
val create : sw:Eio.Switch.t -> env:Eio_unix.Stdenv.base ->
+
val create : sw:Eio.Switch.t -> fs:Eio.Fs.dir_ty Eio.Path.t ->
?version:string -> string -> t
-
-
(** Create cache using default OS-specific location *)
-
val default : sw:Eio.Switch.t -> env:Eio_unix.Stdenv.base ->
-
?app_name:string -> unit -> t
(** {1 Field accessors} *)
···
(** {1 Pretty printing} *)
(** Pretty printer for cache *)
-
val pp : Format.formatter -> t -> unit
+
val pp : Format.formatter -> t -> unit
+1 -1
toru/lib/toru/dune
···
xdg))
(documentation
-
(package toru))
+
(package toru))