1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162(*
* Copyright (C) 2023 Thomas Leonard
* Copyright (C) 2026 Memfs developers
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)open!HermeticopenEio_fs_mem_coretypeentry=Image.entry=|Dirof{path:string;perm:int}|Fileof{path:string;perm:int;contents:string}|Symlinkof{path:string;target:string}letfindpathentries=List.find_map(function|FilefwhenString.equalf.pathpath->Somef.contents|_->None)entriesletload=Image.loadletpp_mlppfentries=Fmt.pfppf"(* Generated by eio-fs-crunch. Do not edit. *)@.@.";Fmt.pfppf"let entries : Eio_fs_mem.Crunch.entry list =@.";Fmt.pfppf" Eio_fs_mem.Crunch.@.";Fmt.pfppf" [@.";List.iter(function|Dir{path;perm}->Fmt.pfppf" Dir { path = %S; perm = 0o%03o };@."pathperm|File{path;perm;contents}->Fmt.pfppf" File { path = %S; perm = 0o%03o; contents = %S };@."pathpermcontents|Symlink{path;target}->Fmt.pfppf" Symlink { path = %S; target = %S };@."pathtarget)entries;Fmt.pfppf" ]@.@.";Fmt.pfppf"let load ?os ?clock () = Eio_fs_mem.Crunch.load ?os ?clock entries@."letinterface="(* Generated by eio-fs-crunch. Do not edit. *)\n\n\
val entries : Eio_fs_mem.Crunch.entry list\n\
(** The embedded file tree. *)\n\n\
val load :\n\
\ ?os:[< `Linux | `Macos | `Windows ] ->\n\
\ ?clock:_ Eio.Time.clock ->\n\
\ unit ->\n\
\ [ `Close | Eio.Fs.dir_ty ] Eio.Path.t\n\
(** [load ~os ~clock ()] is the root of a new in-memory filesystem holding\n\
\ {!entries}, as {!Eio_fs_mem.Crunch.load} makes it. *)\n"