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

[Filepath] add Filepath.Normalized.is_file

parent 547e1155
No related branches found
No related tags found
No related merge requests found
...@@ -252,6 +252,10 @@ module Normalized = struct ...@@ -252,6 +252,10 @@ module Normalized = struct
let pp_abs fmt p = Format.fprintf fmt "%s" p let pp_abs fmt p = Format.fprintf fmt "%s" p
let unknown = normalize "" let unknown = normalize ""
let is_unknown fp = equal fp unknown let is_unknown fp = equal fp unknown
let is_file fp =
try
(Unix.stat (fp :> string)).Unix.st_kind = Unix.S_REG
with _ -> false
end end
type position = type position =
......
...@@ -144,6 +144,12 @@ module Normalized: sig ...@@ -144,6 +144,12 @@ module Normalized: sig
(** @since 20.0-Calcium *) (** @since 20.0-Calcium *)
val is_unknown: t -> bool val is_unknown: t -> bool
(** [is_file f] returns [true] iff [f] points to a regular file
(or a symbolic link pointing to a file).
Returns [false] if any errors happen when [stat]'ing the file.
@since Frama-C+dev *)
val is_file: t -> bool
end end
(** Describes a position in a source file. (** Describes a position in a source file.
......
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