package fileutils
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=eff581c488e9309eb02268bbfa3d4c9c30ff40d45f7b1e9ef300b3ef0e831462
sha512=2c5e75b894e9f5e3b003d61977a87f5c6964a89d844949eedc55f97c5875cc52052182420bbb4e73925d306479c66400df74e4adfccc5b2102347d13e99505cf
doc/fileutils/FilePath/index.html
Module FilePath
Source
Operations on abstract filenames.
This module allow to manipulate string or abstract representation of a filename.
Abstract representation of a filename allow to decode it only once, and should speed up further operation on it (comparison in particular). If you intend to do a lot of processing on filename, you should consider using its abstract representation.
This module manipulate abstract path that are not bound to a real filesystem. In particular, it makes the assumption that there is no symbolic link that should modify the meaning of a path. If you intend to use this module against a real set of filename, the best solution is to apply to every filename to solve symbolic link through FileUtil.readlink
.
Filename type.
Extension type.
Exceptions and types
We do not have recognized any OS, please contact upstream.
The filename use was empty.
The last component of the filename does not support extension (Root, ParentDir...)
Ordering
compare fl1 fl2
Give an order between the two filename. The classification is done by sub directory relation, fl1
< fl2
iff fl1
is a subdirectory of fl2
, and lexicographical order of each part of the reduce filename when fl1
and fl2
has no hierarchical relation
Standard operations
Extract only the file name of a filename. Returns an empty string for directory-only paths like "dir/"
.
Extract the directory name of a filename. Returns an empty string for file-only paths like "file"
.
Return the shortest filename which is equal to the filename given. It remove the "." in Unix filename, for example. If no_symlink
flag is set, consider that the path doesn't contain symlink and in this case ".." for Unix filename are also reduced.
Create an absolute filename from a filename relative and an absolute base filename.
Create a filename which is relative to the base filename.
reparent fln_src fln_dst fln
Return the same filename as fln
but the root is no more fln_src
but fln_dst
. It replaces the fln_src
prefix by fln_dst
.
Extension
Extension is define as the suffix of a filename, just after the last ".".
Extracts the extension. Raises Not_found
if there is no extension.
Add an extension with a "." before. Using this function with an empty extension string creates a filename with a trailing dot.
PATH-like operation
PATH-like refers the environment variable PATH. This variable holds a list of filename. The functions string_of_path
and path_of_string
allow to convert this kind of list by using the good separator between filename.
Filename specifications
Definition of operations for path manipulation.
Generic operations.
Generic operations, with type filename and extension as strings.
Operations on filenames for other OS. The DefaultPath
always match the current OS.
Default operating system.
Unix operating system.
Win32 operating system.
Cygwin operating system.