Add Path.change_extension
Signed-off-by: David Allsopp <david.allsopp@metastack.com>
This commit is contained in:
parent
a7406ab169
commit
9180f88dc3
|
@ -411,3 +411,7 @@ let rm_rf =
|
|||
match Unix.lstat fn with
|
||||
| exception Unix.Unix_error(ENOENT, _, _) -> ()
|
||||
| _ -> loop fn
|
||||
|
||||
let change_extension ~ext t =
|
||||
let t = try Filename.chop_extension t with Not_found -> t in
|
||||
t ^ ext
|
||||
|
|
|
@ -101,3 +101,6 @@ val rmdir : t -> unit
|
|||
val unlink : t -> unit
|
||||
val unlink_no_err : t -> unit
|
||||
val rm_rf : t -> unit
|
||||
|
||||
(** Changes the extension of the filename (or adds an extension if there was none) *)
|
||||
val change_extension : ext:string -> t -> t
|
||||
|
|
Loading…
Reference in New Issue