Skip to content
Snippets Groups Projects
Commit a417261e authored by Andre Maroneze's avatar Andre Maroneze
Browse files

[Filepath] add "/" when concatenating paths via Filepath.Normalized.concat

parent fa557f72
No related branches found
No related tags found
No related merge requests found
...@@ -368,7 +368,7 @@ struct ...@@ -368,7 +368,7 @@ struct
try try
List.fold_left List.fold_left
(fun dummy d -> (fun dummy d ->
let name = Datatype.Filepath.concat d ("/" ^ s) in let name = Datatype.Filepath.concat d s in
if Sys.file_exists (name :> string) if Sys.file_exists (name :> string)
then raise (Found name) then raise (Found name)
else dummy) else dummy)
...@@ -389,7 +389,7 @@ struct ...@@ -389,7 +389,7 @@ struct
let filepath = let filepath =
match base_dirs () with match base_dirs () with
| [] -> assert false | [] -> assert false
| d :: _ -> Datatype.Filepath.concat d ("/" ^ s) | d :: _ -> Datatype.Filepath.concat d s
in in
match mode with match mode with
| `Must_exist -> | `Must_exist ->
...@@ -417,7 +417,7 @@ struct ...@@ -417,7 +417,7 @@ struct
let s_dirname = Filename.dirname s in let s_dirname = Filename.dirname s in
let base_dir = get_dir ~mode s_dirname in let base_dir = get_dir ~mode s_dirname in
let s_basename = Filename.basename s in let s_basename = Filename.basename s in
let filepath = Datatype.Filepath.concat base_dir ("/" ^ s_basename) in let filepath = Datatype.Filepath.concat base_dir s_basename in
match mode with match mode with
| `Must_exist -> | `Must_exist ->
if Sys.file_exists (filepath :> string) if Sys.file_exists (filepath :> string)
......
...@@ -237,7 +237,7 @@ module Normalized = struct ...@@ -237,7 +237,7 @@ module Normalized = struct
type t = string type t = string
let of_string ?existence ?base_name s = normalize ?existence ?base_name s let of_string ?existence ?base_name s = normalize ?existence ?base_name s
let concat ?existence t s = normalize ?existence (t ^ s) let concat ?existence t s = normalize ?existence (t ^ "/" ^ s)
let to_pretty_string s = pretty s let to_pretty_string s = pretty s
let equal : t -> t -> bool = (=) let equal : t -> t -> bool = (=)
let compare = String.compare let compare = String.compare
......
...@@ -103,8 +103,12 @@ module Normalized: sig ...@@ -103,8 +103,12 @@ module Normalized: sig
*) *)
val of_string: ?existence:existence -> ?base_name:string -> string -> t val of_string: ?existence:existence -> ?base_name:string -> string -> t
(** @return the normalized path resulting from the concatenation of the given (** [concat ~existence dir file] returns the normalized path
path and string. *) resulting from the concatenation of [dir] ^ "/" ^ [file].
The resulting path must respect [existence].
@since Frama-C+dev
*)
val concat: ?existence:existence -> t -> string -> t val concat: ?existence:existence -> t -> string -> t
(** [to_pretty_string p] returns [p] prettified, (** [to_pretty_string p] returns [p] prettified,
......
...@@ -1189,12 +1189,12 @@ let get_output () = ...@@ -1189,12 +1189,12 @@ let get_output () =
let name = Project.get_unique_name project in let name = Project.get_unique_name project in
if name = "default" then base if name = "default" then base
else else
let dir = Datatype.Filepath.concat base ("/" ^ name) in let dir = Datatype.Filepath.concat base name in
make_output_dir (dir :> string) ; dir make_output_dir (dir :> string) ; dir
let get_output_dir d = let get_output_dir d =
let base = get_output () in let base = get_output () in
let path = Datatype.Filepath.concat base ("/" ^ d) in let path = Datatype.Filepath.concat base d in
make_output_dir (path :> string) ; path make_output_dir (path :> string) ; path
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
...@@ -1218,7 +1218,7 @@ let get_session ~force () = ...@@ -1218,7 +1218,7 @@ let get_session ~force () =
let get_session_dir ~force d = let get_session_dir ~force d =
let base = get_session ~force () in let base = get_session ~force () in
let path = Datatype.Filepath.concat base ("/" ^ d) in let path = Datatype.Filepath.concat base d in
if force then make_output_dir (path :> string) ; path if force then make_output_dir (path :> string) ; path
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment