From 9e2f1e93ec649f07542887ea15b892146eb41b90 Mon Sep 17 00:00:00 2001
From: Andre Maroneze <andre.maroneze@cea.fr>
Date: Mon, 9 Oct 2023 15:37:02 +0200
Subject: [PATCH] [Filepath] add Normalized.concats

---
 src/libraries/utils/filepath.ml  | 3 +++
 src/libraries/utils/filepath.mli | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/src/libraries/utils/filepath.ml b/src/libraries/utils/filepath.ml
index 3689f5a2ef2..959969454f5 100644
--- a/src/libraries/utils/filepath.ml
+++ b/src/libraries/utils/filepath.ml
@@ -278,6 +278,9 @@ module Normalized = struct
 
   let of_string ?existence ?base_name s = normalize ?existence ?base_name s
   let concat ?existence t s = normalize ?existence (t ^ "/" ^ s)
+  let concats ?existence t sl =
+    let s' = List.fold_left (fun acc s -> acc ^ "/" ^ s) "" sl in
+    normalize ?existence (t ^ s')
   let to_pretty_string s = pretty s
   let to_string_list l = l
   let equal : t -> t -> bool = (=)
diff --git a/src/libraries/utils/filepath.mli b/src/libraries/utils/filepath.mli
index 451937d4da7..0813cca428b 100644
--- a/src/libraries/utils/filepath.mli
+++ b/src/libraries/utils/filepath.mli
@@ -82,6 +82,14 @@ module Normalized: sig
   *)
   val concat: ?existence:existence -> t -> string -> t
 
+  (**
+     [concats ~existence dir paths] concatenates a list of paths, as per
+     the [concat] function.
+
+     @since Frama-C+dev
+  *)
+  val concats: ?existence:existence -> t -> string list -> t
+
   (** [to_pretty_string p] returns [p] prettified,
       that is, a relative path-like string.
       Note that this prettified string may contain symbolic dirs and is thus
-- 
GitLab