mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-14 23:33:28 +00:00
Documented path substitution by compiler (#21662)
Document compiler path substitution (nim-lang#19928)
This commit is contained in:
@@ -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
|
||||
-----------------
|
||||
|
||||
11
doc/nimc.md
11
doc/nimc.md
@@ -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
|
||||
|
||||
@@ -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:
|
||||
##
|
||||
|
||||
Reference in New Issue
Block a user