You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
20 KiB

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>IBase__Utils (infer.IBase__Utils)</title><link rel="stylesheet" href="../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> <a href="../index.html">infer</a> &#x00BB; IBase__Utils</nav><h1>Module <code>IBase__Utils</code></h1></header><dl><dt class="spec value" id="val-find_files"><a href="#val-find_files" class="anchor"></a><code><span class="keyword">val</span> find_files : <span>path:string</span> <span>&#45;&gt;</span> <span>extension:string</span> <span>&#45;&gt;</span> <span>string list</span></code></dt><dd><p>recursively traverse a path for files ending with a given extension</p></dd></dl><dl><dt class="spec value" id="val-fold_folders"><a href="#val-fold_folders" class="anchor"></a><code><span class="keyword">val</span> fold_folders : <span>init:<span class="type-var">'acc</span></span> <span>&#45;&gt;</span> <span>f:<span>(<span class="type-var">'acc</span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> <span class="type-var">'acc</span>)</span></span> <span>&#45;&gt;</span> <span>path:string</span> <span>&#45;&gt;</span> <span class="type-var">'acc</span></code></dt><dd><p>recursively traverse a path for folders, returning resuls by a given fold function</p></dd></dl><dl><dt class="spec value" id="val-string_crc_hex32"><a href="#val-string_crc_hex32" class="anchor"></a><code><span class="keyword">val</span> string_crc_hex32 : string <span>&#45;&gt;</span> string</code></dt><dd><p>Compute a 32-character hexadecimal crc using the Digest module</p></dd></dl><dl><dt class="spec value" id="val-read_file"><a href="#val-read_file" class="anchor"></a><code><span class="keyword">val</span> read_file : string <span>&#45;&gt;</span> <span><span>(<span>string list</span>, string)</span> <a href="../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.Result.t</span></code></dt><dd><p>read a source file and return a list of lines</p></dd></dl><dl><dt class="spec value" id="val-normalize_path_from"><a href="#val-normalize_path_from" class="anchor"></a><code><span class="keyword">val</span> normalize_path_from : <span>root:string</span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> string * string</code></dt><dd><p><code>normalize_path_from ~root path</code> removes &quot;..&quot; and &quot;.&quot; parts of <code>root/path</code> when possible and returns the new <code>root</code> and <code>path</code>, eg if <code>root = &quot;r&quot;</code> and <code>path = &quot;a/../../../foo/./bar&quot;</code> then the result is <code>(&quot;../foo/bar&quot;, &quot;.&quot;)</code> (in particular &quot;r/a/../../../foo/./bar&quot; and &quot;./../foo/bar&quot; represent the same file)</p></dd></dl><dl><dt class="spec value" id="val-normalize_path"><a href="#val-normalize_path" class="anchor"></a><code><span class="keyword">val</span> normalize_path : string <span>&#45;&gt;</span> string</code></dt><dd><p>Normalize a path without a root</p></dd></dl><dl><dt class="spec value" id="val-filename_to_absolute"><a href="#val-filename_to_absolute" class="anchor"></a><code><span class="keyword">val</span> filename_to_absolute : <span>root:string</span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> string</code></dt><dd><p>Convert a filename to an absolute one if it is relative, and normalize &quot;.&quot; and &quot;..&quot;</p></dd></dl><dl><dt class="spec value" id="val-filename_to_relative"><a href="#val-filename_to_relative" class="anchor"></a><code><span class="keyword">val</span> filename_to_relative : <span>?&#8288;force_full_backtrack:bool</span> <span>&#45;&gt;</span> <span>?&#8288;backtrack:int</span> <span>&#45;&gt;</span> <span>root:string</span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> <span>string option</span></code></dt><dd><p>Convert an absolute filename to one relative to a