aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2019-12-20 16:25:56 -0600
committerGanesh Viswanathan <dev@genotrance.com>2019-12-20 16:25:56 -0600
commit90e81aa47264093171d8267fa25659d00dd56a4d (patch)
tree12b64d346de47abdd65c719c0b43f73192a07bd5
parent54dfd61b1bda02f3ce0124e47192018c1e8b349f (diff)
downloadnimterop-90e81aa47264093171d8267fa25659d00dd56a4d.tar.gz
nimterop-90e81aa47264093171d8267fa25659d00dd56a4d.zip
Fix stub addition to type blocktoast-1
-rw-r--r--nimterop/toast.nim8
1 files changed, 5 insertions, 3 deletions
diff --git a/nimterop/toast.nim b/nimterop/toast.nim
index 871230d..5923e56 100644
--- a/nimterop/toast.nim
+++ b/nimterop/toast.nim
@@ -222,9 +222,11 @@ proc main(
# Include in wrapper file
data = outputFile.readFile()
- if "type\n" in data:
- # In existing type block
- data = data.replace("type\n", "type\n" & stubData)
+ let
+ idx = data.find("\ntype\n")
+ if idx != -1:
+ # In first existing type block
+ data = data[0 ..< idx+6] & stubData & data[idx+6 .. ^1]
else:
# At the top if none already
data = "type\n" & stubData & data