Update documentation.

This commit is contained in:
Daniel Kirchner 2018-08-09 20:46:22 +02:00
parent 954d7433bd
commit a7885e0b0a
2 changed files with 11 additions and 11 deletions

View File

@ -100,11 +100,10 @@ When the compiler is invoked, it is not only possible to specify how to
discover the first element of a path, but it is possible to specify path prefix discover the first element of a path, but it is possible to specify path prefix
remappings so that e.g. ``github.com/ethereum/dapp-bin/library`` is remapped to remappings so that e.g. ``github.com/ethereum/dapp-bin/library`` is remapped to
``/usr/local/dapp-bin/library`` and the compiler will read the files from there. ``/usr/local/dapp-bin/library`` and the compiler will read the files from there.
If multiple remappings can be applied, the one with the longest key is tried first. This If multiple remappings can be applied, the one with the longest key is tried first.
allows for a "fallback-remapping" with e.g. ``""`` maps to An empty prefix is not allowed. Furthermore, these remappings can depend on the context,
``"/usr/local/include/solidity"``. Furthermore, these remappings can which allows you to configure packages to import e.g. different versions of a library
depend on the context, which allows you to configure packages to of the same name.
import e.g. different versions of a library of the same name.
**solc**: **solc**:
@ -148,7 +147,7 @@ Note that solc only allows you to include files from certain directories:
They have to be in the directory (or subdirectory) of one of the explicitly They have to be in the directory (or subdirectory) of one of the explicitly
specified source files or in the directory (or subdirectory) of a remapping specified source files or in the directory (or subdirectory) of a remapping
target. If you want to allow direct absolute includes, just add the target. If you want to allow direct absolute includes, just add the
remapping ``=/``. remapping ``/=/``.
If there are multiple remappings that lead to a valid file, the remapping If there are multiple remappings that lead to a valid file, the remapping
with the longest common prefix is chosen. with the longest common prefix is chosen.

View File

@ -23,14 +23,15 @@ it is also possible to provide path redirects using ``prefix=path`` in the follo
:: ::
solc github.com/ethereum/dapp-bin/=/usr/local/lib/dapp-bin/ =/usr/local/lib/fallback file.sol solc github.com/ethereum/dapp-bin/=/usr/local/lib/dapp-bin/ file.sol
This essentially instructs the compiler to search for anything starting with This essentially instructs the compiler to search for anything starting with
``github.com/ethereum/dapp-bin/`` under ``/usr/local/lib/dapp-bin`` and if it does not ``github.com/ethereum/dapp-bin/`` under ``/usr/local/lib/dapp-bin``.
find the file there, it will look at ``/usr/local/lib/fallback`` (the empty prefix ``solc`` will not read files from the filesystem that lie outside of
always matches). ``solc`` will not read files from the filesystem that lie outside of
the remapping targets and outside of the directories where explicitly specified source the remapping targets and outside of the directories where explicitly specified source
files reside, so things like ``import "/etc/passwd";`` only work if you add ``=/`` as a remapping. files reside, so things like ``import "/etc/passwd";`` only work if you add ``/=/`` as a remapping.
An empty remapping prefix is not allowed.
If there are multiple matches due to remappings, the one with the longest common prefix is selected. If there are multiple matches due to remappings, the one with the longest common prefix is selected.