diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-07-09 14:26:00 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-07-09 14:26:00 +0200 |
commit | 5e82ffc8d560dd3b2b7bbda034e5436fb036c20d (patch) | |
tree | 039f8112cb5c42ba76c883d62a5b8b4bb69f7dc6 /lib | |
parent | 66f37971e92ee9a573d1dd2fb82d5120e6ccb0ed (diff) | |
download | Nim-5e82ffc8d560dd3b2b7bbda034e5436fb036c20d.tar.gz |
Nimscript: added support for 'patchFile'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system/nimscript.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/system/nimscript.nim b/lib/system/nimscript.nim index db6d72d7b..cc96bcba8 100644 --- a/lib/system/nimscript.nim +++ b/lib/system/nimscript.nim @@ -65,6 +65,21 @@ proc hint*(name: string; val: bool) = let v = if val: "on" else: "off" hintImpl(name & "]:" & v, "hint[" & name & "]:" & v) +proc patchFile*(package, filename, replacement: string) = + ## Overrides the location of a given file belonging to the + ## passed package. + ## If the ``replacement`` is not an absolute path, the path + ## 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! + ## + ## Example: + ## + ## .. code-block:: nim + ## + ## patchFile("stdlib", "asyncdispatch", "patches/replacement") + discard + proc getCommand*(): string = ## Gets the Nim command that the compiler has been invoked with, for example ## "c", "js", "build", "help". |