Module Topkg.Fpath
File system paths.
Note. Only use "/"
as a directory separator, even on Windows platforms.
File system paths
type t
= fpath
The type for file system paths.
val append : t -> t -> t
append p q
appendsq
top
as follows:- If
q
is absolute thenq
is returned - Otherwise appends
q
's segments top
using a"/"
if needed.
- If
val is_dir_path : t -> bool
is_dir_path p
istrue
iffp
represents a directory. This means thatp
is.
,..
or ends with/
,/..
or/.
.
val is_file_path : t -> bool
is_file_path p
isnot (is_dir_path true)
.
val basename : t -> string
basename p
isp
's basename, the last non empty segment ofp
.
val dirname : t -> string
dirname p
isp
's dirname,p
without its last non empty segment.
File extensions
val get_ext : t -> string
get_ext p
isp
's filename extension (including the'.'
) or the empty string if there is no extension
val has_ext : string -> t -> bool
has_ext e p
istrue
iffe
is a suffix ofp
.