From ccfb6d58dc469a8f8a7e2e09bd520aea71f8cbf3 Mon Sep 17 00:00:00 2001 From: Estevan Castilho Date: Thu, 17 Sep 2026 02:20:19 +0000 Subject: Implement `resolve` in terms of the path utilities --- lib/runtime/Context.ml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'lib/runtime/Context.ml') diff --git a/lib/runtime/Context.ml b/lib/runtime/Context.ml index 000f5d6..2189735 100644 --- a/lib/runtime/Context.ml +++ b/lib/runtime/Context.ml @@ -6,23 +6,7 @@ module Error = struct ("segment" |=| Concepts.Value.String segment) end -let resolve { Protocols.Context.root; _ } name = - let open Utilities.Result in - let rec walk handle = function - | [] -> Ok (Protocols.Handle.copy handle) - | segment :: rest -> - let* directory = - Protocols.Directory.from handle - |> Option.to_result ~none:(Error.not_a_directory segment) - in - let* found = Protocols.Directory.find directory segment in - match found with - | None -> Ok None - | Some child -> - Fun.protect ~finally:(fun () -> Protocols.Handle.release child) - (fun () -> walk child rest) - in - String.split_on_char '/' name |> List.filter (fun segment -> segment <> "") |> walk root +let resolve { Protocols.Context.root; _ } name = Kernel.Path.lookup root name let over ~snapshot ~root ?(cancelled = fun () -> false) () = { Protocols.Context.snapshot -- cgit v1.2.3