diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2020-04-28 11:54:00 -0500 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2020-04-28 11:54:00 -0500 |
| commit | 2060c8964d6960808b86f767ea3949da9b3341e6 (patch) | |
| tree | e6f91a30349fb43d25441380397cfe8b4516e30d | |
| parent | c57666d5dbafaf88c4a8b53149ce9b07f9391242 (diff) | |
| download | nimterop-2060c8964d6960808b86f767ea3949da9b3341e6.tar.gz nimterop-2060c8964d6960808b86f767ea3949da9b3341e6.zip | |
Prevent plugin outdir override by configuration
| -rw-r--r-- | nimterop.nimble | 2 | ||||
| -rw-r--r-- | nimterop/getters.nim | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/nimterop.nimble b/nimterop.nimble index a6fba1e..e520c71 100644 --- a/nimterop.nimble +++ b/nimterop.nimble @@ -10,7 +10,7 @@ installDirs = @["nimterop"] installFiles = @["config.nims"] # Dependencies -requires "nim >= 0.20.2", "regex#v0.13.1", "cligen >= 0.9.43" +requires "nim >= 0.20.2", "regex >= 0.14.1", "cligen >= 0.9.45" import nimterop/docs diff --git a/nimterop/getters.nim b/nimterop/getters.nim index d829cf0..ebd3432 100644 --- a/nimterop/getters.nim +++ b/nimterop/getters.nim @@ -731,7 +731,13 @@ proc loadPlugin*(gState: State, sourcePath: string) = flags = if fileExists(sourcePath & ".cfg"): "" else: getNimConfigFlags(getCurrentDir()) - cmd = &"{gState.nim.sanitizePath} c --app:lib --gc:markAndSweep {flags} {sourcePath.sanitizePath}" + + # Always set output to same directory as source, prevents override + outflags = &"--out:\"{pdll.extractFilename()}\" --outdir:\"{pdll.parentDir()}\"" + + # Compile plugin as library with `markAndSweep` GC + cmd = &"{gState.nim.sanitizePath} c --app:lib --gc:markAndSweep {flags} {outflags} {sourcePath.sanitizePath}" + discard execAction(cmd) doAssert fileExists(pdll), "No plugin binary generated for " & sourcePath |
