Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate builtins.toPath #2524

Merged
merged 1 commit into from Nov 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 6 additions & 23 deletions doc/manual/expressions/builtins.xml
Expand Up @@ -1027,22 +1027,8 @@ Evaluates to <literal>[ "foo" ]</literal>.
<replaceable>path</replaceable></term>

<listitem><para>Return <literal>true</literal> if the path
<replaceable>path</replaceable> exists, and
<literal>false</literal> otherwise. One application of this
function is to conditionally include a Nix expression containing
user configuration:

<programlisting>
let
fileName = builtins.getEnv "CONFIG_FILE";
config =
if fileName != "" &amp;&amp; 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>
<replaceable>path</replaceable> exists at evaluation time, and
<literal>false</literal> otherwise.

</varlistentry>

Expand Down Expand Up @@ -1344,13 +1330,10 @@ in foo</programlisting>

<varlistentry><term><function>builtins.toPath</function> <replaceable>s</replaceable></term>

<listitem><para>Convert the string value
<replaceable>s</replaceable> into a path value. The string
<replaceable>s</replaceable> must represent an absolute path
(i.e., must start with <literal>/</literal>). The path need not
exist. The resulting path is canonicalised, e.g.,
<literal>builtins.toPath "//foo/xyzzy/../bar/"</literal> returns
<literal>/foo/bar</literal>.</para></listitem>
<listitem><para> DEPRECATED. Use <literal>/. + "/path"</literal>
to convert a string into an absolute path. For relative paths,
use <literal>./. + "/path"</literal>.
</para></listitem>

</varlistentry>

Expand Down