Finalize support for Nim 0.20

Closes #32, closes #41.
This commit is contained in:
Ruslan Mustakov 2019-09-15 15:39:10 +07:00
commit 19b0c23d62
8 changed files with 91 additions and 131 deletions

View file

@ -38,7 +38,13 @@ proc `$`*(self: GodotString): string =
proc toGodotString*(s: string): GodotString {.inline.} =
## Converts the Nim string into ``GodotString``
initGodotString(result, cstring(s), cint(s.len + 1))
when (NimMajor, NimMinor, NimPatch) < (0, 19, 0):
if s.isNil:
initGodotString(result)
else:
initGodotString(result, cstring(s), cint(s.len + 1))
else:
initGodotString(result, cstring(s), cint(s.len + 1))
proc toGodotString*(s: cstring): GodotString {.inline.} =
## Converts the cstring into ``GodotString``