about summary refs log tree commit diff
path: root/doc/manual
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-11-08T12·22+0100
committerGitHub <noreply@github.com>2018-11-08T12·22+0100
commit750400e0fa9d8c32afa15bba94c29c03935c1da5 (patch)
tree4cdb974cfc679ae518b9bad34764c9f8689a1a7b /doc/manual
parent812e39313c2bcf8909b83e1e8bc548a85dcd626c (diff)
parent0bea4a50e035c06805ac65360b1b50d3681e4f87 (diff)
Merge pull request #2524 from domenkozar/deprecate-toPath
Deprecate builtins.toPath
Diffstat (limited to 'doc/manual')
-rw-r--r--doc/manual/expressions/builtins.xml29
1 files changed, 6 insertions, 23 deletions
diff --git a/doc/manual/expressions/builtins.xml b/doc/manual/expressions/builtins.xml
index 8d12da9b1356..4a20ffd81be8 100644
--- a/doc/manual/expressions/builtins.xml
+++ b/doc/manual/expressions/builtins.xml
@@ -1077,22 +1077,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>
 
@@ -1409,13 +1395,10 @@ in foo</programlisting>
   <varlistentry xml:id='builtin-toPath'>
     <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>