-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fde6a5f
Showing
47 changed files
with
2,199 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>File (bantorra.Bantorra.File)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.3"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../odoc.support/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> – <a href="../../index.html">bantorra</a> » <a href="../index.html">Bantorra</a> » File</nav><header class="odoc-preamble"><h1>Module <code><span>Bantorra.File</span></code></h1><p>Basic I/O.</p></header><nav class="odoc-toc"><ul><li><a href="#path-types">Path types</a></li><li><a href="#basic-i/o">Basic I/O</a></li><li><a href="#directories">Directories</a></li><li><a href="#locating-files">Locating Files</a></li><li><a href="#special-directories">Special Directories</a></li></ul></nav><div class="odoc-content"><h2 id="path-types"><a href="#path-types" class="anchor"></a>Path types</h2><div class="odoc-spec"><div class="spec type anchored" id="type-path"><a href="#type-path" class="anchor"></a><code><span><span class="keyword">type</span> path</span><span> = <a href="../FilePath/index.html#type-t">FilePath.t</a></span></code></div></div><h2 id="basic-i/o"><a href="#basic-i/o" class="anchor"></a>Basic I/O</h2><div class="odoc-spec"><div class="spec value anchored" id="val-read"><a href="#val-read" class="anchor"></a><code><span><span class="keyword">val</span> read : <span><a href="#type-path">path</a> <span class="arrow">-></span></span> string</span></code></div><div class="spec-doc"><p><code>read path</code> reads the content of string <code>str</code> the file at <code>path</code> (in binary mode). If there was already a file at <code>path</code>, it will be overwritten.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-write"><a href="#val-write" class="anchor"></a><code><span><span class="keyword">val</span> write : <span><a href="#type-path">path</a> <span class="arrow">-></span></span> <span>string <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p><code>write path str</code> writes the string <code>str</code> the file at <code>path</code> (in binary mode). If there was already a file at <code>path</code>, it will be overwritten.</p></div></div><h2 id="directories"><a href="#directories" class="anchor"></a>Directories</h2><div class="odoc-spec"><div class="spec value anchored" id="val-get_cwd"><a href="#val-get_cwd" class="anchor"></a><code><span><span class="keyword">val</span> get_cwd : <span>unit <span class="arrow">-></span></span> <a href="#type-path">path</a></span></code></div><div class="spec-doc"><p><code>get_cwd ()</code> returns the current working directory.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-ensure_dir"><a href="#val-ensure_dir" class="anchor"></a><code><span><span class="keyword">val</span> ensure_dir : <span><a href="#type-path">path</a> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p><code>ensure_dir dir</code> effectively implements <code>mkdir -p dir</code> in OCaml.</p></div></div><h2 id="locating-files"><a href="#locating-files" class="anchor"></a>Locating Files</h2><div class="odoc-spec"><div class="spec value anchored" id="val-file_exists"><a href="#val-file_exists" class="anchor"></a><code><span><span class="keyword">val</span> file_exists : <span><a href="#type-path">path</a> <span class="arrow">-></span></span> bool</span></code></div><div class="spec-doc"><p><code>file_exists file</code> checks whether <code>file</code> is a regular file.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-locate_anchor"><a href="#val-locate_anchor" class="anchor"></a><code><span><span class="keyword">val</span> locate_anchor : <span><span class="label">anchor</span>:string <span class="arrow">-></span></span> <span><a href="#type-path">path</a> <span class="arrow">-></span></span> <a href="#type-path">path</a> * <a href="../UnitPath/index.html#type-t">UnitPath.t</a></span></code></div><div class="spec-doc"><p><code>locate_anchor ~anchor dir</code> finds the closest regular file named <code>anchor</code> in <code>dir</code> or its ancestors in the file system tree.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">dir</span> <p>The starting directory.</p></li></ul><ul class="at-tags"><li class="returns"><span class="at-tag">returns</span> <p>(1) the first directory that holds a regular file named <code>anchor</code> on the way from <code>dir</code> to the root directory; and (2) the relative path from the returned directory to <code>dir</code>.</p><p>For example, on a typical Linux system, suppose there is no file called <code>anchor.txt</code> under directiors <code>/usr/lib/gcc/</code> and <code>/usr/lib/</code>, but there is such a file under <code>/usr/</code>. <code>locate_anchor ~anchor:"anchor.txt" "/usr/lib/gcc"</code> will return <code>"/usr/", ["lib"; "gcc"]</code> and <code>locate_anchor ~anchor:"anchor.txt" "/usr/"</code> will return <code>"/usr/", []</code>.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-locate_hijacking_anchor"><a href="#val-locate_hijacking_anchor" class="anchor"></a><code><span><span class="keyword">val</span> locate_hijacking_anchor : | ||
<span><span class="label">anchor</span>:string <span class="arrow">-></span></span> | ||
<span><span class="label">root</span>:<a href="#type-path">path</a> <span class="arrow">-></span></span> | ||
<span><a href="../UnitPath/index.html#type-t">UnitPath.t</a> <span class="arrow">-></span></span> | ||
<span><a href="#type-path">path</a> option</span></span></code></div></div><h2 id="special-directories"><a href="#special-directories" class="anchor"></a>Special Directories</h2><div class="odoc-spec"><div class="spec value anchored" id="val-get_home"><a href="#val-get_home" class="anchor"></a><code><span><span class="keyword">val</span> get_home : <span>unit <span class="arrow">-></span></span> <a href="#type-path">path</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_xdg_config_home"><a href="#val-get_xdg_config_home" class="anchor"></a><code><span><span class="keyword">val</span> get_xdg_config_home : <span><span class="label">app_name</span>:string <span class="arrow">-></span></span> <a href="#type-path">path</a></span></code></div><div class="spec-doc"><p>Get the per-user config directory based on <code>XDG_CONFIG_HOME</code> with reasonable default values on major platforms.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_xdg_cache_home"><a href="#val-get_xdg_cache_home" class="anchor"></a><code><span><span class="keyword">val</span> get_xdg_cache_home : <span><span class="label">app_name</span>:string <span class="arrow">-></span></span> <a href="#type-path">path</a></span></code></div><div class="spec-doc"><p>Get the per-user persistent cache directory based on <code>XDG_CACHE_HOME</code> with reasonable default values on major platforms.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_package_dir"><a href="#val-get_package_dir" class="anchor"></a><code><span><span class="keyword">val</span> get_package_dir : <span>string <span class="arrow">-></span></span> <a href="#type-path">path</a></span></code></div></div></div></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>FilePath (bantorra.Bantorra.FilePath)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.3"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../odoc.support/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> – <a href="../../index.html">bantorra</a> » <a href="../index.html">Bantorra</a> » FilePath</nav><header class="odoc-preamble"><h1>Module <code><span>Bantorra.FilePath</span></code></h1><p>Absolute file paths.</p></header><div class="odoc-content"><p>The API mimics the <code>fpath</code> library, but with optional arguments <code>relative_to</code> and <code>expanding_tilde</code> to turn relative paths into absolute ones when needed.</p><p>No functions in this module access the actual file systems.</p><div class="odoc-spec"><div class="spec type anchored" id="type-t"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> t</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-equal"><a href="#val-equal" class="anchor"></a><code><span><span class="keyword">val</span> equal : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> <span><a href="#type-t">t</a> <span class="arrow">-></span></span> bool</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-compare"><a href="#val-compare" class="anchor"></a><code><span><span class="keyword">val</span> compare : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> <span><a href="#type-t">t</a> <span class="arrow">-></span></span> int</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-is_root"><a href="#val-is_root" class="anchor"></a><code><span><span class="keyword">val</span> is_root : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> bool</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-is_dir_path"><a href="#val-is_dir_path" class="anchor"></a><code><span><span class="keyword">val</span> is_dir_path : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> bool</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-to_dir_path"><a href="#val-to_dir_path" class="anchor"></a><code><span><span class="keyword">val</span> to_dir_path : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> <a href="#type-t">t</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-parent"><a href="#val-parent" class="anchor"></a><code><span><span class="keyword">val</span> parent : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> <a href="#type-t">t</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-basename"><a href="#val-basename" class="anchor"></a><code><span><span class="keyword">val</span> basename : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> string</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-has_ext"><a href="#val-has_ext" class="anchor"></a><code><span><span class="keyword">val</span> has_ext : <span>string <span class="arrow">-></span></span> <span><a href="#type-t">t</a> <span class="arrow">-></span></span> bool</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_ext"><a href="#val-add_ext" class="anchor"></a><code><span><span class="keyword">val</span> add_ext : <span>string <span class="arrow">-></span></span> <span><a href="#type-t">t</a> <span class="arrow">-></span></span> <a href="#type-t">t</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-rem_ext"><a href="#val-rem_ext" class="anchor"></a><code><span><span class="keyword">val</span> rem_ext : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> <a href="#type-t">t</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_unit_seg"><a href="#val-add_unit_seg" class="anchor"></a><code><span><span class="keyword">val</span> add_unit_seg : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> <span>string <span class="arrow">-></span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Append a unit segment to a file path.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-append_unit"><a href="#val-append_unit" class="anchor"></a><code><span><span class="keyword">val</span> append_unit : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> <span><a href="../UnitPath/index.html#type-t">UnitPath.t</a> <span class="arrow">-></span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Append a unit path to a file path.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-of_fpath"><a href="#val-of_fpath" class="anchor"></a><code><span><span class="keyword">val</span> of_fpath : <span><span class="optlabel">?relative_to</span>:<a href="#type-t">t</a> <span class="arrow">-></span></span> <span><span class="optlabel">?expanding_tilde</span>:<a href="#type-t">t</a> <span class="arrow">-></span></span> <span><span class="xref-unresolved">Fpath</span>.t <span class="arrow">-></span></span> <a href="#type-t">t</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-to_fpath"><a href="#val-to_fpath" class="anchor"></a><code><span><span class="keyword">val</span> to_fpath : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> <span class="xref-unresolved">Fpath</span>.t</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-of_string"><a href="#val-of_string" class="anchor"></a><code><span><span class="keyword">val</span> of_string : <span><span class="optlabel">?relative_to</span>:<a href="#type-t">t</a> <span class="arrow">-></span></span> <span><span class="optlabel">?expanding_tilde</span>:<a href="#type-t">t</a> <span class="arrow">-></span></span> <span>string <span class="arrow">-></span></span> <a href="#type-t">t</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-to_string"><a href="#val-to_string" class="anchor"></a><code><span><span class="keyword">val</span> to_string : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> string</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pp"><a href="#val-pp" class="anchor"></a><code><span><span class="keyword">val</span> pp : <span><span class="label">relative_to</span>:<a href="#type-t">t</a> <span class="arrow">-></span></span> <span><span class="xref-unresolved">Stdlib</span>.Format.formatter <span class="arrow">-></span></span> <span><a href="#type-t">t</a> <span class="arrow">-></span></span> unit</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pp_abs"><a href="#val-pp_abs" class="anchor"></a><code><span><span class="keyword">val</span> pp_abs : <span><span class="xref-unresolved">Stdlib</span>.Format.formatter <span class="arrow">-></span></span> <span><a href="#type-t">t</a> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>An alias of <code>Fpath.pp</code>.</p></div></div></div></body></html> |
Oops, something went wrong.