forked from lix-project/lix
Deprecate builtins.toPath
This commit is contained in:
parent
8327a7a8fa
commit
0bea4a50e0
|
@ -1027,22 +1027,8 @@ Evaluates to <literal>[ "foo" ]</literal>.
|
||||||
<replaceable>path</replaceable></term>
|
<replaceable>path</replaceable></term>
|
||||||
|
|
||||||
<listitem><para>Return <literal>true</literal> if the path
|
<listitem><para>Return <literal>true</literal> if the path
|
||||||
<replaceable>path</replaceable> exists, and
|
<replaceable>path</replaceable> exists at evaluation time, and
|
||||||
<literal>false</literal> otherwise. One application of this
|
<literal>false</literal> otherwise.
|
||||||
function is to conditionally include a Nix expression containing
|
|
||||||
user configuration:
|
|
||||||
|
|
||||||
<programlisting>
|
|
||||||
let
|
|
||||||
fileName = builtins.getEnv "CONFIG_FILE";
|
|
||||||
config =
|
|
||||||
if fileName != "" && builtins.pathExists (builtins.toPath fileName)
|
|
||||||
then import (builtins.toPath fileName)
|
|
||||||
else { someSetting = false; }; <lineannotation># default configuration</lineannotation>
|
|
||||||
in config.someSetting</programlisting>
|
|
||||||
|
|
||||||
(Note that <envar>CONFIG_FILE</envar> must be an absolute path for
|
|
||||||
this to work.)</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@ -1344,13 +1330,10 @@ in foo</programlisting>
|
||||||
|
|
||||||
<varlistentry><term><function>builtins.toPath</function> <replaceable>s</replaceable></term>
|
<varlistentry><term><function>builtins.toPath</function> <replaceable>s</replaceable></term>
|
||||||
|
|
||||||
<listitem><para>Convert the string value
|
<listitem><para> DEPRECATED. Use <literal>/. + "/path"</literal>
|
||||||
<replaceable>s</replaceable> into a path value. The string
|
to convert a string into an absolute path. For relative paths,
|
||||||
<replaceable>s</replaceable> must represent an absolute path
|
use <literal>./. + "/path"</literal>.
|
||||||
(i.e., must start with <literal>/</literal>). The path need not
|
</para></listitem>
|
||||||
exist. The resulting path is canonicalised, e.g.,
|
|
||||||
<literal>builtins.toPath "//foo/xyzzy/../bar/"</literal> returns
|
|
||||||
<literal>/foo/bar</literal>.</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue