Documented path substitution by compiler (#21662)

Document compiler path substitution (nim-lang#19928)
This commit is contained in:
Raynei
2023-04-21 09:37:21 -04:00
committed by GitHub
parent b54b03d04f
commit 48de0d0cf4
3 changed files with 14 additions and 0 deletions

View File

@@ -6676,6 +6676,8 @@ even when one version does not export some of these identifiers.
The `import` statement is only allowed at the top level.
String literals can be used for import/include statements.
The compiler performs [path substitution](nimc.html#compiler-usage-commandminusline-switches) when used.
Include statement
-----------------

View File

@@ -32,6 +32,17 @@ Compiler Usage
Command-line switches
---------------------
All options that take a `PATH` or `DIR` argument are subject to path substitution:
- `$nim`: The global nim prefix path
- `$lib`: The stdlib path
- `$home` and `~`: The user's home path
- `$config`: The directory of the module currently being compiled
- `$projectname`: The project file's name without file extension
- `$projectpath` and `$projectdir`: The project file's path
- `$nimcache`: The nimcache path
Basic command-line switches are:
.. no syntax highlighting in the below included files at the moment

View File

@@ -86,6 +86,7 @@ proc patchFile*(package, filename, replacement: string) =
## is interpreted to be local to the Nimscript file that contains
## the call to `patchFile`, Nim's `--path` is not used at all
## to resolve the filename!
## The compiler also performs `path substitution <nimc.html#compiler-usage-commandminusline-switches>`_ on `replacement`.
##
## Example:
##