123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051(* TODO already exists in stdune/bin.ml *)letpath_sep=ifSys.win32then';'else':'letdune_dir_locations_env_var="DUNE_DIR_LOCATIONS"letdune_ocaml_stdlib_env_var="DUNE_OCAML_STDLIB"letdune_ocaml_hardcoded_env_var="DUNE_OCAML_HARDCODED"letdune_sourceroot_env_var="DUNE_SOURCEROOT"typeentry={package:string;section:Dune_section.t;dir:string}letdecode_dune_dir_locations=letrecauxacc=function|[]->Some(List.revacc)|package::section::dir::l->letsection=matchDune_section.of_stringsectionwith|None->invalid_arg("Dune-site: Unknown section "^section)|Somes->sinaux({package;section;dir}::acc)l|_->Noneinfuns->letl=String.split_on_charpath_sepsinaux[]l;;letencode_dune_dir_locations=letaddb{package;section;dir}=Buffer.add_stringbpackage;Buffer.add_charbpath_sep;Buffer.add_stringb(Dune_section.to_stringsection);Buffer.add_charbpath_sep;Buffer.add_stringbdirinletrecloopb=function|[]->()|[x]->addbx|x::xs->addbx;Buffer.add_charbpath_sep;loopbxsinfuns->letb=Buffer.create16inloopbs;Buffer.contentsb;;