UNPKG

@ciao-lang/ts-ciao-interface

Version:

Simple Ciao interface for node.

153 lines 37.5 kB
<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="theme-color" content="#273f79"/><link rel="stylesheet" href="lpdoc.css" type="text/css"/><script type="text/javascript" src="lpdoc.js"></script><title>Additional operating system utilities &mdash; The Ciao System v1.22</title></head><body><div class="lpdoc-page fixleftbar"><a href="#" id="sidebar-toggle-button" class="lpdoc-navbutton"><span id="sidebar-button-arrow">&#9776;</span></a><div id="sidebar" class="lpdoc-sidebar"><div style="height: 40px; margin-left: auto; margin-right: auto"><img src="ciao-logo_autofig.png" width=auto height=100%></div><div class="lpdoc-nav"><span class="lpdoc-on-right"><a class="lpdoc-navbutton" href="ExtraLibs.html">&#x2191;</a><a class="lpdoc-navbutton" href="getopts.html">&#x2190;</a><a class="lpdoc-navbutton" href="parse_shell_args.html">&#x2192;</a><a class="lpdoc-navbutton" href="ciaosearch.html">&#x1F50D;</a></span><span><a href="ciaofulltoc.html">TOC</a></span></div><hr></hr><ul class="lpdoc-itemize-sectpath"><li><a href="ciao.html">The Ciao System</a> &raquo;<br/> </li><li><a href="ExtraLibs.html">PART VIII - Additional libraries</a> &raquo;<br/> </li><li><a href=""><strong>Additional operating system utilities</strong></a></li></ul><hr></hr><em>ON THIS PAGE</em><ul><li><a href="#Usage and interface">Usage and interface</a></li><li><a href="#Documentation on exports">Documentation on exports</a></li><li><a href="#Documentation on imports">Documentation on imports</a></li></ul></div><div class="lpdoc-main"><div id=""><h1>Additional operating system utilities</h1><a class="lpdoc-idx-anchor" href="ciaosearch.html#system_extra"></a> <strong>Author(s):</strong> <a class="lpdoc-idx-anchor" id="Manuel Hermenegildo" href="ciaosearch.html#Manuel Hermenegildo">Manuel Hermenegildo</a>, <a class="lpdoc-idx-anchor" id="Jose F. Morales" href="ciaosearch.html#Jose F. Morales">Jose F. Morales</a>.<p> This module groups some extensions to library <a class="lpdoc-idx-anchor" id="0" href="system.html"><tt>system</tt></a> that have been found convenient, but which are still in development, their interface has not been fixed, etc.<br/><div id="Usage and interface"><h2>Usage and interface</h2><div class="lpdoc-cartouche"><ul><li><strong>Library usage:</strong><br/><tt>:- use_module(library(system_extra)).</tt><li><strong>Exports:</strong><br/><ul class="lpdoc-itemize-minus"><li><em>Predicates:</em><br/><a class="lpdoc-idx-anchor" id="1" href="#warn_on_nosuccess/1"><tt>warn_on_nosuccess/1</tt></a>, <a class="lpdoc-idx-anchor" id="2" href="#ignore_nosuccess/1"><tt>ignore_nosuccess/1</tt></a>, <a class="lpdoc-idx-anchor" id="3" href="#del_dir_if_empty/1"><tt>del_dir_if_empty/1</tt></a>, <a class="lpdoc-idx-anchor" id="4" href="#empty_dir/1"><tt>empty_dir/1</tt></a>, <a class="lpdoc-idx-anchor" id="5" href="#move_files/2"><tt>move_files/2</tt></a>, <a class="lpdoc-idx-anchor" id="6" href="#move_file/2"><tt>move_file/2</tt></a>, <a class="lpdoc-idx-anchor" id="7" href="#copy_files/2"><tt>copy_files/2</tt></a>, <a class="lpdoc-idx-anchor" id="8" href="#copy_files/3"><tt>copy_files/3</tt></a>, <a class="lpdoc-idx-anchor" id="9" href="#copy_files_nofail/3"><tt>copy_files_nofail/3</tt></a>, <a class="lpdoc-idx-anchor" id="10" href="#del_file_nofail/1"><tt>del_file_nofail/1</tt></a>, <a class="lpdoc-idx-anchor" id="11" href="#del_files_nofail/1"><tt>del_files_nofail/1</tt></a>, <a class="lpdoc-idx-anchor" id="12" href="#file_to_line/2"><tt>file_to_line/2</tt></a>, <a class="lpdoc-idx-anchor" id="13" href="#replace_strings_in_file/3"><tt>replace_strings_in_file/3</tt></a>, <a class="lpdoc-idx-anchor" id="14" href="#backup_file/1"><tt>backup_file/1</tt></a>, <a class="lpdoc-idx-anchor" id="15" href="#move_if_diff/3"><tt>move_if_diff/3</tt></a>, <a class="lpdoc-idx-anchor" id="16" href="#set_file_owner/2"><tt>set_file_owner/2</tt></a>, <a class="lpdoc-idx-anchor" id="17" href="#set_file_perms/2"><tt>set_file_perms/2</tt></a>, <a class="lpdoc-idx-anchor" id="18" href="#set_exec_perms/2"><tt>set_exec_perms/2</tt></a>, <a class="lpdoc-idx-anchor" id="19" href="#mkpath/1"><tt>mkpath/1</tt></a>, <a class="lpdoc-idx-anchor" id="20" href="#mkpath/2"><tt>mkpath/2</tt></a>, <a class="lpdoc-idx-anchor" id="21" href="#mkpath/3"><tt>mkpath/3</tt></a>, <a class="lpdoc-idx-anchor" id="22" href="#mkpath_mode/3"><tt>mkpath_mode/3</tt></a>, <a class="lpdoc-idx-anchor" id="23" href="#mkpath_mode/2"><tt>mkpath_mode/2</tt></a>, <a class="lpdoc-idx-anchor" id="24" href="#mkpath_mode/1"><tt>mkpath_mode/1</tt></a>, <a class="lpdoc-idx-anchor" id="25" href="#mktempdir_in_tmp/2"><tt>mktempdir_in_tmp/2</tt></a>, <a class="lpdoc-idx-anchor" id="26" href="#rmtempdir/1"><tt>rmtempdir/1</tt></a>, <a class="lpdoc-idx-anchor" id="27" href="#create_rel_link/2"><tt>create_rel_link/2</tt></a>, <a class="lpdoc-idx-anchor" id="28" href="#create_link/2"><tt>create_link/2</tt></a>, <a class="lpdoc-idx-anchor" id="29" href="#relpath/3"><tt>relpath/3</tt></a>, <a class="lpdoc-idx-anchor" id="30" href="#istty/1"><tt>istty/1</tt></a>, <a class="lpdoc-idx-anchor" id="31" href="#datime_atom/1"><tt>datime_atom/1</tt></a>, <a class="lpdoc-idx-anchor" id="32" href="#datime_atom/2"><tt>datime_atom/2</tt></a>, <a class="lpdoc-idx-anchor" id="33" href="#datime_string/1"><tt>datime_string/1</tt></a>, <a class="lpdoc-idx-anchor" id="34" href="#datime_string/2"><tt>datime_string/2</tt></a>, <a class="lpdoc-idx-anchor" id="35" href="#datime_to_string/2"><tt>datime_to_string/2</tt></a>, <a class="lpdoc-idx-anchor" id="36" href="#replace_strings/3"><tt>replace_strings/3</tt></a>. <li><em>Regular Types:</em><br/><a class="lpdoc-idx-anchor" id="37" href="#perms_term/1"><tt>perms_term/1</tt></a>, <a class="lpdoc-idx-anchor" id="38" href="#valid_mode/1"><tt>valid_mode/1</tt></a>. </ul></ul></div></div><div id="Documentation on exports"><h2>Documentation on exports</h2><div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="warn_on_nosuccess/1" href="ciaosearch.html#warn_on_nosuccess/1">warn_on_nosuccess/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>warn_on_nosuccess(G)</tt> </span><p>Call <span class="lpdoc-var">G</span> (cutting solutions, i.e., as <a class="lpdoc-idx-anchor" id="39" href="iso_misc.html#once/1"><tt>once/1</tt></a>) and show warning messages if something went wrong (failure and exceptions).</p><ul class="lpdoc-itemize-minus"></ul> <em>Meta-predicate</em> with arguments: <tt>warn_on_nosuccess(goal)</tt>.<br/></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="ignore_nosuccess/1" href="ciaosearch.html#ignore_nosuccess/1">ignore_nosuccess/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>ignore_nosuccess(G)</tt> </span><p>Call <span class="lpdoc-var">G</span> and ignore if something went wrong (failure and exceptions).</p><ul class="lpdoc-itemize-minus"></ul> <em>Meta-predicate</em> with arguments: <tt>ignore_nosuccess(goal)</tt>.<br/></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="del_dir_if_empty/1" href="ciaosearch.html#del_dir_if_empty/1">del_dir_if_empty/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>del_dir_if_empty(D)</tt> </span><p>Delete <span class="lpdoc-var">D</span> if it is an empty directory.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="40" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">D</span> is an atom. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="empty_dir/1" href="ciaosearch.html#empty_dir/1">empty_dir/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>empty_dir(D)</tt> </span><p><span class="lpdoc-var">D</span> is an empty directory</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="41" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">D</span> is an atom. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="move_files/2" href="ciaosearch.html#move_files/2">move_files/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>move_files(Files,Dir)</tt> </span><p>Move <span class="lpdoc-var">Files</span> to directory <span class="lpdoc-var">Dir</span> (note that to move only one file to a directory, <a class="lpdoc-idx-anchor" id="42" href="system.html#rename_file/2"><tt>rename_file/2</tt></a> can be used).</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="43" href="basic_props.html#list/2"><tt>basic_props:list/2</tt></a>)</span><span><span class="lpdoc-var">Files</span> is a list of <span class="lpdoc-var">atm</span>s. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="44" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">Dir</span> is an atom. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="move_file/2" href="ciaosearch.html#move_file/2">move_file/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>move_file(File,Dir)</tt> </span><p>Move <span class="lpdoc-var">File</span> to directory <span class="lpdoc-var">Dir</span></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="45" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">File</span> is an atom. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="46" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">Dir</span> is an atom. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="copy_files/2" href="ciaosearch.html#copy_files/2">copy_files/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>copy_files(Files,Dir)</tt> </span><p>Like <a class="lpdoc-idx-anchor" id="47" href="#copy_files/3"><tt>copy_files/3</tt></a>, with empty options list.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="48" href="basic_props.html#list/2"><tt>basic_props:list/2</tt></a>)</span><span><span class="lpdoc-var">Files</span> is a list of <span class="lpdoc-var">atm</span>s. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="49" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">Dir</span> is an atom. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="copy_files/3" href="ciaosearch.html#copy_files/3">copy_files/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>copy_files(Files,Dir,Opts)</tt> </span><p>Copy <span class="lpdoc-var">Files</span> to directory <span class="lpdoc-var">Dir</span>, using <span class="lpdoc-var">Opts</span> as the option list for copy. See <a class="lpdoc-idx-anchor" id="50" href="system.html#copy_file/3"><tt>copy_file/3</tt></a> for the list of options. Note that to move only one file to a directory, <a class="lpdoc-idx-anchor" id="51" href="system.html#rename_file/2"><tt>rename_file/2</tt></a> can be used.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="52" href="basic_props.html#list/2"><tt>basic_props:list/2</tt></a>)</span><span><span class="lpdoc-var">Files</span> is a list of <span class="lpdoc-var">atm</span>s. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="53" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">Dir</span> is an atom. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="54" href="system.html#copy_options/1"><tt>system:copy_options/1</tt></a>)</span><span><span class="lpdoc-var">Opts</span> is a list of file copy options. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="copy_files_nofail/3" href="ciaosearch.html#copy_files_nofail/3">copy_files_nofail/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>copy_files_nofail(Files,Dir,Opts)</tt> </span><p>Like <a class="lpdoc-idx-anchor" id="55" href="#copy_files/3"><tt>copy_files/3</tt></a>, but do not fail in case of errors.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="56" href="basic_props.html#list/2"><tt>basic_props:list/2</tt></a>)</span><span><span class="lpdoc-var">Files</span> is a list of <span class="lpdoc-var">atm</span>s. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="57" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">Dir</span> is an atom. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="58" href="system.html#copy_options/1"><tt>system:copy_options/1</tt></a>)</span><span><span class="lpdoc-var">Opts</span> is a list of file copy options. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="del_file_nofail/1" href="ciaosearch.html#del_file_nofail/1">del_file_nofail/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>del_file_nofail(File)</tt> </span><p>Like <a class="lpdoc-idx-anchor" id="59" href="system.html#delete_file/1"><tt>delete_file/1</tt></a>, but do not fail in case of errors.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="60" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">File</span> is an atom. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="del_files_nofail/1" href="ciaosearch.html#del_files_nofail/1">del_files_nofail/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>del_files_nofail(Files)</tt> </span><p>Like <a class="lpdoc-idx-anchor" id="61" href="#del_file_nofail/1"><tt>del_file_nofail/1</tt></a>, but takes list of files in <span class="lpdoc-var">Files</span>.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="62" href="basic_props.html#list/2"><tt>basic_props:list/2</tt></a>)</span><span><span class="lpdoc-var">Files</span> is a list of <span class="lpdoc-var">atm</span>s. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="file_to_line/2" href="ciaosearch.html#file_to_line/2">file_to_line/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>file_to_line(File,Str)</tt> </span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="63" href="basic_props.html#list/2"><tt>basic_props:list/2</tt></a>)</span><span><span class="lpdoc-var">File</span> is a list of <span class="lpdoc-var">atm</span>s. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="64" href="basic_props.html#string/1"><tt>basic_props:string/1</tt></a>)</span><span><span class="lpdoc-var">Str</span> is a string (a list of character codes). </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="replace_strings_in_file/3" href="ciaosearch.html#replace_strings_in_file/3">replace_strings_in_file/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>replace_strings_in_file(Ss,F1,F2)</tt> </span><p>Like <a class="lpdoc-idx-anchor" id="65" href="#replace_strings/3"><tt>replace_strings/3</tt></a> but from file <span class="lpdoc-var">F1</span> to file <span class="lpdoc-var">F2</span>.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="66" href="basic_props.html#list/2"><tt>basic_props:list/2</tt></a>)</span><span><span class="lpdoc-var">Ss</span> is a list of <span class="lpdoc-var">string</span>s. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="67" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">F1</span> is an atom. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="68" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">F2</span> is an atom. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="backup_file/1" href="ciaosearch.html#backup_file/1">backup_file/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>backup_file(FileName)</tt> </span><p>Save a backup copy of file <span class="lpdoc-var">FileName</span></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="69" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">FileName</span> is an atom. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="move_if_diff/3" href="ciaosearch.html#move_if_diff/3">move_if_diff/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>move_if_diff(From,To,NewOrOld)</tt> </span><p>If <span class="lpdoc-var">To</span> does not exist, or its contents are different from <span class="lpdoc-var">From</span>, delete <span class="lpdoc-var">To</span> and rename <span class="lpdoc-var">From</span> to <span class="lpdoc-var">To</span>. <span class="lpdoc-var">NewOrOld</span> is unified with <tt>new</tt> or <tt>old</tt> depending on whether the new or the old file is preserved.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="70" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">From</span> is an atom. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="71" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">To</span> is an atom. </span> <li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="72" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">NewOrOld</span> is an atom. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="set_file_owner/2" href="ciaosearch.html#set_file_owner/2">set_file_owner/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>set_file_owner(File,Owner)</tt> </span><p>Set user/group of a file.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="73" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">File</span> is currently a term which is not a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="74" href="term_typing.html#nonvar/1"><tt>term_typing:nonvar/1</tt></a>)</span><span><span class="lpdoc-var">Owner</span> is currently a term which is not a free variable. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="set_file_perms/2" href="ciaosearch.html#set_file_perms/2">set_file_perms/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>set_file_perms(File,Perms)</tt> </span><p>Set permissions of <span class="lpdoc-var">File</span> to <span class="lpdoc-var">Perms</span>.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="75" href="#perms_term/1"><tt>system_extra:perms_term/1</tt></a>)</span><span><span class="lpdoc-var">Perms</span> is a term providing modes for User, Group, and Others. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="76" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">File</span> is an atom. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">REGTYPE</span><a class="lpdoc-idx-anchor" id="perms_term/1" href="ciaosearch.html#perms_term/1">perms_term/1</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>perms_term(Perms)</tt> </span><p><span class="lpdoc-var">Perms</span> is a term providing valid permissions (``modes&apos;&apos;) for User, Group, and Others. These are all <a class="lpdoc-idx-anchor" id="77" href="#valid_mode/1"><tt>valid_mode/1</tt></a>s. Defined as follows: <pre class="lpdoc-codeblock">perms_term(perms(U,G,O)) :- valid_mode(U), valid_mode(G), valid_mode(O). </pre><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>perms_term(Perms)</tt> </span><p><span class="lpdoc-var">Perms</span> is a term providing modes for User, Group, and Others.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">REGTYPE</span><a class="lpdoc-idx-anchor" id="valid_mode/1" href="ciaosearch.html#valid_mode/1">valid_mode/1</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>valid_mode(Mode)</tt> </span><p><span class="lpdoc-var">Mode</span> is an atom that provides a valid set of file permissions (a valid ``mode&apos;&apos;). Defined as follows: <pre class="lpdoc-codeblock">valid_mode(&apos;&apos;). valid_mode(&apos;X&apos;). valid_mode(x). valid_mode(w). valid_mode(wX). valid_mode(wx). valid_mode(r). valid_mode(rX). valid_mode(rx). valid_mode(rw). valid_mode(rwX). valid_mode(rwx). </pre><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>valid_mode(Mode)</tt> </span><p><span class="lpdoc-var">Mode</span> is a file permissions mode.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="set_exec_perms/2" href="ciaosearch.html#set_exec_perms/2">set_exec_perms/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>set_exec_perms(File,Perms)</tt> </span><p>Set file permissions, but treat regular files as directories w.r.t. &apos;X&apos; flag</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="mkpath/1" href="ciaosearch.html#mkpath/1">mkpath/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>mkpath(Path)</tt> </span><p>Creates the directories necessary to access the given <span class="lpdoc-var">Path</span> (which can be absolute or relative).</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="78" href="stream_basic.html#sourcename/1"><tt>stream_basic:sourcename/1</tt></a>)</span><span><span class="lpdoc-var">Path</span> is a source name. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="mkpath/2" href="ciaosearch.html#mkpath/2">mkpath/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>mkpath(Path,Perms)</tt> </span><p>Like <a class="lpdoc-idx-anchor" id="79" href="ciaosearch.html#mkpath"><tt>mkpath</tt></a>, but sets permissions of new directories as <span class="lpdoc-var">Perms</span>.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="80" href="stream_basic.html#sourcename/1"><tt>stream_basic:sourcename/1</tt></a>)</span><span><span class="lpdoc-var">Path</span> is a source name. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="81" href="basic_props.html#term/1"><tt>basic_props:term/1</tt></a>)</span><span><span class="lpdoc-var">Perms</span> is any term. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="mkpath/3" href="ciaosearch.html#mkpath/3">mkpath/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>mkpath(Path,Perms,Owner)</tt> </span><p>Like <a class="lpdoc-idx-anchor" id="82" href="ciaosearch.html#mkpath"><tt>mkpath</tt></a>, but sets permissions and owner of new directories to <span class="lpdoc-var">Perms</span> and <span class="lpdoc-var">Owner</span>.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="83" href="stream_basic.html#sourcename/1"><tt>stream_basic:sourcename/1</tt></a>)</span><span><span class="lpdoc-var">Path</span> is a source name. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="84" href="basic_props.html#term/1"><tt>basic_props:term/1</tt></a>)</span><span><span class="lpdoc-var">Perms</span> is any term. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="85" href="basic_props.html#term/1"><tt>basic_props:term/1</tt></a>)</span><span><span class="lpdoc-var">Owner</span> is any term. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="mkpath_mode/3" href="ciaosearch.html#mkpath_mode/3">mkpath_mode/3</a></div><div class="lpdoc-deftext">No further documentation available for this predicate.</div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="mkpath_mode/2" href="ciaosearch.html#mkpath_mode/2">mkpath_mode/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><p>Equivalent to <tt>mkpath_mode(Path,Mode,_)</tt>.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="86" href="stream_basic.html#sourcename/1"><tt>stream_basic:sourcename/1</tt></a>)</span><span><span class="lpdoc-var">Arg1</span> is a source name. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="87" href="basic_props.html#int/1"><tt>basic_props:int/1</tt></a>)</span><span><span class="lpdoc-var">Arg2</span> is an integer. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="mkpath_mode/1" href="ciaosearch.html#mkpath_mode/1">mkpath_mode/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><p>Equivalent to <tt>mkpath_mode(Path,0o777,_)</tt>.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="88" href="stream_basic.html#sourcename/1"><tt>stream_basic:sourcename/1</tt></a>)</span><span><span class="lpdoc-var">Arg1</span> is a source name. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="mktempdir_in_tmp/2" href="ciaosearch.html#mktempdir_in_tmp/2">mktempdir_in_tmp/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>mktempdir_in_tmp(Template,Path)</tt> </span><p>Create a directory in the temporary directory using <span class="lpdoc-var">Template</span> (see <a class="lpdoc-idx-anchor" id="89" href="system.html#mktemp_in_tmp/2"><tt>mktemp_in_tmp/2</tt></a>). An empty file <tt>CREATED_WITH_MKTEMPDIR</tt> is created inside <span class="lpdoc-var">Path</span> as a safety check for <a class="lpdoc-idx-anchor" id="90" href="#rmtempdir/1"><tt>rmtempdir/1</tt></a>.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="rmtempdir/1" href="ciaosearch.html#rmtempdir/1">rmtempdir/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>rmtempdir(Path)</tt> </span><p>Remove the temporary directory <span class="lpdoc-var">Path</span> (recursively) created with <a class="lpdoc-idx-anchor" id="91" href="#mktempdir_in_tmp/2"><tt>mktempdir_in_tmp/2</tt></a>. As a safety check, this predicate throws an exception if the <tt>CREATED_WITH_MKTEMPDIR</tt> file is not in <span class="lpdoc-var">Path</span>.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="create_rel_link/2" href="ciaosearch.html#create_rel_link/2">create_rel_link/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>create_rel_link(From,To)</tt> </span><p>Create a <em>relocatable</em> symlink (computing relative paths) (e.g., <tt>/a/b/c (symlink) -&gt; /a/d/e</tt> becomes <tt>/a/b/c (symlink) -&gt; ../d/e</tt></p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="create_link/2" href="ciaosearch.html#create_link/2">create_link/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>create_link(From,To)</tt> </span><p>Create a symlink from <span class="lpdoc-var">From</span> to <span class="lpdoc-var">To</span>. On platforms where symlinks are not supported (Windows) the file is copied instead. The file <span class="lpdoc-var">To</span> is removed if it existed before.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="relpath/3" href="ciaosearch.html#relpath/3">relpath/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>relpath(A,B,C)</tt> </span><p><span class="lpdoc-var">C</span> is a path to <span class="lpdoc-var">B</span> relative to <span class="lpdoc-var">A</span> (using <tt>..</tt> if needed) (e.g., <tt>/a/b/c -&gt; /a/d/e</tt> becomes <tt>/a/b/c -&gt; ../../d/e</tt>. Assume both are absolute, otherwise just return <span class="lpdoc-var">B</span>.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="istty/1" href="ciaosearch.html#istty/1">istty/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>istty(FD)</tt> </span><p>Check if the file descriptor is associated with a terminal.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="datime_atom/1" href="ciaosearch.html#datime_atom/1">datime_atom/1</a></div><div class="lpdoc-deftext">No further documentation available for this predicate.</div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="datime_atom/2" href="ciaosearch.html#datime_atom/2">datime_atom/2</a></div><div class="lpdoc-deftext">No further documentation available for this predicate.</div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="datime_string/1" href="ciaosearch.html#datime_string/1">datime_string/1</a></div><div class="lpdoc-deftext">No further documentation available for this predicate.</div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="datime_string/2" href="ciaosearch.html#datime_string/2">datime_string/2</a></div><div class="lpdoc-deftext">No further documentation available for this predicate.</div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="datime_to_string/2" href="ciaosearch.html#datime_to_string/2">datime_to_string/2</a></div><div class="lpdoc-deftext">No further documentation available for this predicate.</div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="replace_strings/3" href="ciaosearch.html#replace_strings/3">replace_strings/3</a></div><div class="lpdoc-deftext">No further documentation available for this predicate.</div></div><p> </div><div id="Documentation on imports"><h2>Documentation on imports</h2>This module has the following direct dependencies:<ul class="lpdoc-itemize-minus"><li><em>System library modules:</em><br/><a class="lpdoc-idx-anchor" id="92" href="regexp_code.html"><tt>regexp_code</tt></a>, <a class="lpdoc-idx-anchor" id="93" href="system.html"><tt>system</tt></a>, <a class="lpdoc-idx-anchor" id="94" href="pathnames.html"><tt>pathnames</tt></a>, <a class="lpdoc-idx-anchor" id="95" href="messages.html"><tt>messages</tt></a>, <a class="lpdoc-idx-anchor" id="96" href="terms.html"><tt>terms</tt></a>, <a class="lpdoc-idx-anchor" id="97" href="lists.html"><tt>lists</tt></a>, <a class="lpdoc-idx-anchor" id="98" href="stream_utils.html"><tt>stream_utils</tt></a>, <a class="lpdoc-idx-anchor" id="99" href="process.html"><tt>process</tt></a>, <a class="lpdoc-idx-anchor" id="100" href="port_reify.html"><tt>port_reify</tt></a>, <a class="lpdoc-idx-anchor" id="101" href="source_tree.html"><tt>source_tree</tt></a>. <li><em>Packages:</em><br/><a class="lpdoc-idx-anchor" id="102" href="ciaosearch.html#prelude"><tt>prelude</tt></a>, <a class="lpdoc-idx-anchor" id="103" href="ciaosearch.html#initial"><tt>initial</tt></a>, <a class="lpdoc-idx-anchor" id="104" href="condcomp_doc.html"><tt>condcomp</tt></a>, <a class="lpdoc-idx-anchor" id="105" href="assertions_doc.html"><tt>assertions</tt></a>, <a class="lpdoc-idx-anchor" id="106" href="ciaosearch.html#assertions/assertions_basic"><tt>assertions/assertions_basic</tt></a>, <a class="lpdoc-idx-anchor" id="107" href="regtypes_doc.html"><tt>regtypes</tt></a>, <a class="lpdoc-idx-anchor" id="108" href="isomodes_doc.html"><tt>isomodes</tt></a>, <a class="lpdoc-idx-anchor" id="109" href="ciaosearch.html#hiord"><tt>hiord</tt></a>, <a class="lpdoc-idx-anchor" id="110" href="regexp_doc.html"><tt>regexp</tt></a>. </ul></div></div><div class="lpdoc-footer">Generated with LPdoc using Ciao</div></div><div class="lpdoc-clearer"></div></div></body></html>