<htmlxmlns="http://www.w3.org/1999/xhtml"><head><title>Utils (infer.IBase.Utils)</title><linkrel="stylesheet"href="../../../odoc.css"/><metacharset="utf-8"/><metaname="generator"content="odoc 1.5.1"/><metaname="viewport"content="width=device-width,initial-scale=1.0"/><scriptsrc="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><divclass="content"><header><nav><ahref="../index.html">Up</a>–<ahref="../../index.html">infer</a>»<ahref="../index.html">IBase</a>» Utils</nav><h1>Module <code>IBase.Utils</code></h1></header><dl><dtclass="spec value"id="val-find_files"><ahref="#val-find_files"class="anchor"></a><code><spanclass="keyword">val</span> find_files : <span>path:string</span><span>-></span><span>extension:string</span><span>-></span><span>string list</span></code></dt><dd><p>recursively traverse a path for files ending with a given extension</p></dd></dl><dl><dtclass="spec value"id="val-fold_folders"><ahref="#val-fold_folders"class="anchor"></a><code><spanclass="keyword">val</span> fold_folders : <span>init:<spanclass="type-var">'acc</span></span><span>-></span><span>f:<span>(<spanclass="type-var">'acc</span><span>-></span> string <span>-></span><spanclass="type-var">'acc</span>)</span></span><span>-></span><span>path:string</span><span>-></span><spanclass="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><dtclass="spec value"id="val-string_crc_hex32"><ahref="#val-string_crc_hex32"class="anchor"></a><code><spanclass="keyword">val</span> string_crc_hex32 : string <span>-></span> string</code></dt><dd><p>Compute a 32-character hexadecimal crc using the Digest module</p></dd></dl><dl><dtclass="spec value"id="val-read_file"><ahref="#val-read_file"class="anchor"></a><code><spanclass="keyword">val</span> read_file : string <span>-></span><span><span>(<span>string list</span>,string)</span><ahref="../../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><dtclass="spec value"id="val-normalize_path_from"><ahref="#val-normalize_path_from"class="anchor"></a><code><spanclass="keyword">val</span> normalize_path_from : <span>root:string</span><span>-></span> string <span>-></span> string * string</code></dt><dd><p><code>normalize_path_from ~root path</code> removes ".." and "." parts of <code>root/path</code> when possible and returns the new <code>root</code> and <code>path</code>, eg if <code>root = "r"</code> and <code>path = "a/../../../foo/./bar"</code> then the result is <code>("../foo/bar", ".")</code> (in particular "r/a/../../../foo/./bar" and "./../foo/bar" represent the same file)</p></dd></dl><dl><dtclass="spec value"id="val-normalize_path"><ahref="#val-normalize_path"class="anchor"></a><code><spanclass="keyword">val</span> normalize_path : string <span>-></span> string</code></dt><dd><p>Normalize a path without a root</p></dd></dl><dl><dtclass="spec value"id="val-filename_to_absolute"><ahref="#val-filename_to_absolute"class="anchor"></a><code><spanclass="keyword">val</span> filename_to_absolute : <span>root:string</span><span>-></span> string <span>-></span> string</code></dt><dd><p>Convert a filename to an absolute one if it is relative, and normalize "." and ".."</p></dd></dl><dl><dtclass="spec value"id="val-filename_to_relative"><ahref="#val-filename_to_relative"class="anchor"></a><code><spanclass="keyword">val</span> filename_to_relative : <span>?⁠force_full_backtrack:bool</span><span>-></span><span>?⁠backtrack:int</span><span>-></span><span>root:string</span><span>-></span> string <span>-></span><span>string option</span></code></dt><dd><p>Convert an