package shell
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=1e267e9120dc73c7dc94598f68b209622e64942f916dd1c1d3285f2a9fcab214
doc/shell.filename_extended/Filename_extended/index.html
Module Filename_extendedSource
Extensions to Core.Core_filename.
normalize path Removes as much "." and ".." from the path as possible. If the path is absolute they will all be removed.
parent path The parent of the root directory is the root directory
make_relative ~to_:src f returns f relative to src.
make_absolute src Turn src into an absolute path expanded from the current working directory.
expand Makes a path absolute and expands ~ ~username to home directories. In case of error (e.g.: path home of a none existing user) raises Failure with a (hopefully) helpful message.
Splits a given path into a list of strings.
dual to explode
Filename.compare is a comparison that normalizes filenames ("./a" = "a"), uses a more human ready algorithm based on String_extended.collate ("rfc02.txt > rfc1.txt") and extenstions ("a.c" > "a.h").
It is a total comparison on normalized filenames.
val with_open_temp_file :
?in_dir:string ->
?write:(out_channel -> unit) ->
f:(string -> 'a) ->
string ->
string ->
'awith_open_temp_file ~write ~f prefix suffix create a temporary file; runs write on its out_channel and then f on the resulting file. The file is removed once f is done running.
Runs f with a temporary dir as option and removes the directory afterwards.
is_parent dir1 dir2 returns true if dir1 is a parent of dir2
Note: This function is context independent, use expand if you want to consider relatives paths from a given point.
In particular:
- A directory is always the parent of itself.
- The root is the parent of any directory
- An absolute path is never the parent of relative one and vice versa.
"../../a"is never the parent of"."even if this could be true given form the current working directory.